> I would think that Foo.new.respond_to?(:bar) would be false, but it > returns true.
It should be true as the Foo instance responds to a method called bar. > This is because the definition of :respond_to? checks > whether @attributes.include?(method_name), but doesn't take attribute > protection into account. > It doesn't check attributes, it checks the actual methods on the object. It is independent of Rails. > Foo thus does not abide by the general contract of respond_to?: > "respond_to?(:baz) returns true if and only if call(:baz) does not > raise a NoMethodError." Hu? Foo.new *has* a bar method. It just doesn't allow you to set it in mass-assignment. Jonathan -- Jonathan Weiss http://blog.innerewut.de http://twitter.com/jweiss --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
