Skip to content

Commit

Permalink
only add an instance variable if there is an attr reader
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronLasseigne committed Feb 14, 2014
1 parent fbfd99a commit d7660f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/active_interaction/base.rb
Expand Up @@ -200,7 +200,7 @@ def process_inputs(inputs)
inputs.each do |key, value|
fail InvalidValueError, key.inspect if self.class.send(:reserved?, key)

instance_variable_set("@#{key}", value)
instance_variable_set("@#{key}", value) if respond_to?(key)
end

self.class.filters.each do |name, filter|
Expand Down
2 changes: 1 addition & 1 deletion spec/active_interaction/base_spec.rb
Expand Up @@ -54,7 +54,7 @@ def execute
end
end

context 'with an attribute' do
context 'with a reader' do
let(:described_class) do
Class.new(TestInteraction) do
attr_reader :thing
Expand Down

0 comments on commit d7660f0

Please sign in to comment.