On Jan 28, 2:11 am, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Frederick Cheung wrote in post #978021:
> [...]
>
> > I seem to recall that
> > historically, although method_missing etc was overriden to add dynamic
> > methods, respond_to wasn't, which didn't make AR a very good citizen,
> > which may be why this works with projects using old versions of rails
>
> How is that possible?  respond_to? shouldn't need to be overridden to
> take method_missing into account, should it?

The default implementation of respond_to? doesn't know that although a
method (like a attribute accessor) doesn't exist yet, if you were to
call it then method_missing would create it, so respond_to would
return false, even though you would be able to call the method.
Need is a vague word. At a basic level you don't need to override
respond_to, however there was a strong enough feeling that this wasn't
consistent, especially as you'd do things lile

foo.respond_to? :name #=> false
foo.name #=> 'Bob'
foo.respond_to? :name #=> true


Fred

>
>
>
> > Fred
>
> Best,
> -- 
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
>
> Sent from my iPhone
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to