Ruby on Rails Friday, August 30, 2013

On Thu, Aug 29, 2013 at 2:29 PM, starfry <google@jelmail.com> wrote:
I have been working on updating a rails application to 4.0 and spent some time getting to the bottom of why it wasn't working.

What I found was, if a model has a method_missing definition then it is called instead of any accessors. This causes any model set-up to fail.


As far as I am aware, the accessors for attributes have always been generated using method_missing (the method missing hook then actually defines the accessors, so after that method missing is not used).

What might possibly have changed is when this gets triggered. Regardless if you do override method_missing it's a good idea to call to the superclass as other aspects of active record may rely on this.

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CABp077WR%3Du88x0R-T%3D6tHf73mQvk2rSpKhZ1EkMY5oxcuHzrZg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment