Hi,
I have Suggestion, Feature and Vote models.
suggestion embeds_many features
suggestion has_many_related votes
feature has_many_related votes
I am trying to make those has_many_related associations polymorphic.
but I had no luck using options like :polymorphic => true and
has_many_related :votes, :as => :votable
here is the gist with relevant code
http://gist.github.com/454061
as you can see, for the time being I used belongs_to twice in Vote
model, which puts suggestion_id and feature_id fields into each vote,
where I use only one of them. I also have a conditional statement in
votes_controller which recognizes whether I am casting vote on
suggestion or feature.
but this is obviously not true polymorphism. could you please give me
some hints what am I doing wrong and what is the right way, please?
Thanks very much
Josef