1

I have an acts_as_votable voting system working right now.

But, I want to add a second vote link/button system to the same model/user group to track another type of vote. How would I go about doing this? I was thinking to create a whole new table/etc. but thinking if there is an easier solution to track another vote within the same tables?

Thanks in advance!

gitastic
  • 516
  • 7
  • 26

1 Answers1

1

Votable model can be voted under different scopes by the same user:

@post.vote_by :voter => @user1, :vote_scope => 'week'
@post.vote_by :voter => @user1, :vote_scope => 'month'

You can get the votes by scope:

@post.find_votes_for(:vote_scope => 'rank')

There is alot you can do with acts_as_votable gem, you don't need to create new table.

Community
  • 1
  • 1
mohameddiaa27
  • 3,587
  • 1
  • 16
  • 23