I’m have trouble implementing a uniqueness check w/ act_as_voteable
plugin. The 2 approaches I’ve taken:
vote.rb (plugin dir): I tried adding the line
“validates_uniqueness_of” to the votes.rb but there seems to be no
affect
albums.rb (model dir): the validation does not pass but the vote is
being added regardless.
How would I add a model level validation to the act_as_voteable
plugin?
voting action
vote = Vote.new(:vote => true, :user_id => @current_user.id)
albums = Albums.find(params[:id])
albums.votes << vote
vote.rb
class Vote < ActiveRecord::Base
belongs_to :user
def self.find_votes_cast_by_user(user)
find(:all,
:conditions => [“user_id = ?”, user.id],
:order => “created_at DESC”
)
end
end
thanks Dan