[Rails] Re: Rails 3 - polymorphic associations problem with ActiveRecord::Relation
After digging a bit deeper we were able to solve this issue.
The details of the fix are explained here
http://stackoverflow.com/questions/4522288/rails-3-activerecordrelation-random-associations-behavior
The code examples there apply only to rails 3.0.3, but the idea should
be the same for any other rails 3 release.
Basically the belongs_to association files are using the old finder
methods. these old finder methods seem to return an
ActiveRecord::Relation object at random times.
Our solution was to override the find_target method and change the
finders used for the new Rails 3 format (where(...), etc) through a
couple of initializers.
Hopefully similar corrections will be applied to the next rails
release.
Regards
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home