Somebody pointed out in the pull request that it doesn't set the polymorphic type column, so it only solves half that problem. I'm a little curious what it would take to get it to fully work with polymorphic relationships, but maybe that's outside the scope of this change.
On Tuesday, August 7, 2012 8:23:25 AM UTC-4, Peter Brown wrote: > > Hi, > > Guillermo asked me to post this here for feedback: > https://github.com/rails/rails/pull/7273 > > The pull request has some examples and rationale for the change, but > basically it would let you *specify the model name in queries when you'd > normally use a foreign key*. > > These queries would then be equivalent: > > Post.where(:author_id => author) > Post.where(:author => author) > > and so would these: > > Author.where(:posts => {:author_id => author}).joins(:posts) > Author.where(:posts => {:author => author}).joins(:posts) > > TL;DR > > - API is more consistent with other parts of ActiveRecord > - Works with polymorphic relationships > - Better for legacy schemas that don't follow Rails' foreign key > conventions (you don't need to remember column names) > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/9LkJhKUjWXIJ. 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.
