I want to specify the following one-to-one relationship where
an "Event" has one "FeeStructure".
Essentially:
class Event < ActiveRecord::Base
has_one :fee_structure
end
class FeeStructure < ActiveRecord::Base
belongs_to :event
end
The issue though is that FeeStructure is polymorphic.
For example, I have FeeStructureTypeA and FeeStructureTypeB
(they share common characteristics but they have different
representation).
It seems to me that want I''d need to do is the following:
class Event < ActiveRecord::Base
has_one :fee_structure :polymorphic => true
end
class FeeStructureTypeA < ActiveRecord::Base
belongs_to :event, :as => fee_structure
end
class FeeStructureTypeB < ActiveRecord::Base
belongs_to :event, :as => fee_structure
end
However this does not seem to be supported.
Option ":polymorphic" appears to be supported only on
"belongs_to".
Looks like the only way I could make this work is if I would
reverse the relationship. But that does not really make sense
since "Event" is the parent in that relationship.
Am I missing something here to make this work?
Thanks,
P.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---