Sha256: 5b441f322933e6d65180e73af8999490e09d18fbdc83b210dd5c47734b6bd6ee
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
module ActsAsVotable class Vote < ::ActiveRecord::Base attr_accessible :votable_id, :votable_type, :voter_id, :voter_type, :votable, :voter, :vote_flag belongs_to :votable, :polymorphic => true belongs_to :voter, :polymorphic => true validates_presence_of :votable_id validates_presence_of :voter_id def self.true_votes ['up', 'upvote', 'like', 'yes', 'good', 'true', 1, true] end def self.false_votes ['down', 'downvote', 'dislike', 'no', 'bad', 'false', 0, false] end ## # check is word is a true or bad vote # if the word is unknown, then it counts it as a true/good # vote. this exists to allow all voting to be good by default def self.word_is_a_vote_for word !false_votes.include? word end def self.default_voting_args { :vote => true, } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_votable-0.0.5 | lib/acts_as_votable/vote.rb |
acts_as_votable-0.0.4 | lib/acts_as_votable/vote.rb |