I have posts that can be voted on by a polymorphic association. Now I am making comments votable as well. Can I share the same models and logic for this for my comments? Or do I have to make a new model relationship ?
#post.rb
has_many :votes, :as => :votable
has_many :voting_users,
:through => :votes,
:source => :user
#vote.rb
belongs_to :votable, :polymorphic => true
Yes, you should be able to copy the two has_many relationships from your post model and drop them in comment.rb without a problem. Since your vote model is polymorphic, as long as you have
votable_id:integerandvotable_type:stringin thevotestable, everything should work normally.