diff --git a/lib/netsuite/records/record_ref.rb b/lib/netsuite/records/record_ref.rb index f83bac8cd..19ae3e9c7 100644 --- a/lib/netsuite/records/record_ref.rb +++ b/lib/netsuite/records/record_ref.rb @@ -32,7 +32,11 @@ def method_missing(m, *args, &block) super end end - + + def respond_to_missing?(method_name, include_private = false) + attributes.keys.map(&:to_sym).include?(method_name.to_sym) || super + end + end end end diff --git a/spec/netsuite/records/record_ref_spec.rb b/spec/netsuite/records/record_ref_spec.rb index 17d573a61..c46af4d0d 100644 --- a/spec/netsuite/records/record_ref_spec.rb +++ b/spec/netsuite/records/record_ref_spec.rb @@ -43,6 +43,14 @@ record_ref.name.should eql('This is a record_ref') record_ref.banana.should eql('for monkeys') end + + it 'should have truthy result for respond_to existing attribute' do + record_ref.respond_to?(:name).should be_true + end + + it 'should have false result for respond_to missing attribute' do + record_ref.respond_to?(:apple).should be_false + end end end