Could use a few eyes on a couple of very simple patches at #6262 Polymorphic belongs_to associations error if they have conditions when loading target - Ruby on Rails - rails 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!