Hey all,

Could use a few eyes on a couple of very simple patches at 
https://rails.lighthouseapp.com/projects/8994/tickets/6262 if any has some time.

The issue (from the ticket description):

If you define a polymorphic belongs_to association and it has conditions on it, 
those conditions cause a NameError when you try to access the target object, of 
the style saying "hey, there's no such thing as a Note::Notable".

This is because a reflection's sanitized_conditions method calls klass, and 
klass calls class_name, and class_name calls derive_class_name, and, well, 
derive_class_name can't really derive a class name properly, in the case of a 
polymorphic belongs_to, because the reflection doesn't have all the information 
it needs -- the association proxy does.

The patches are for 3-0-stable and master, and they're fairly simple and 
straightforward.

Now, as to whether there's much value in supplying :conditions to a polymorphic 
belongs_to, given the potential for major differences in the table being 
queried, might be debatable, but that's a separate issue. :)

Thanks in advance!

-- 
Ernie Miller
http://metautonomo.us
http://github.com/ernie
http://twitter.com/erniemiller

-- 
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 rubyonrails-c...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to