This project is archived and is in readonly mode.
It should be invalid to go :through a polymorphic belongs_to
Reported by Jon Leighton | December 22nd, 2010 @ 10:18 PM | in 3.x
Consider the following:
class Tagging
belongs_to :taggable, :polymorphic => true
has_many :something, :through => :taggable
end
Obviously the something
association on the
taggable
might only be available at certain times,
depending on what the taggable
actually is.
At the moment, the above example fails, because it tries to look
up the source reflection, which involves getting the
through_reflection.klass
, which doesn't exist.
Whilst it would be theoretically possible to support the above,
it's basically insane. I suggest we add in a
HasManyCantAssociateThroughPolymorphicBelongsToReflection
and raise it properly in
ThroughReflection#check_validity!
.
Comments and changes to this ticket
-
Jon Leighton December 23rd, 2010 @ 11:56 PM
- State changed from open to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>