Sha256: c2ffe75df5997130aea14351d2650531cf7e8fd3e6ac6c5734614db74347ffa1
Contents?: true
Size: 858 Bytes
Versions: 8
Compression:
Stored size: 858 Bytes
Contents
require 'redmineup/helpers/vote_helper' module Redmineup module ActsAsVotable class Vote < ActiveRecord::Base include Helpers::Words if defined?(ProtectedAttributes) || ::ActiveRecord::VERSION::MAJOR < 4 attr_accessible :votable_id, :votable_type, :voter_id, :voter_type, :votable, :voter, :vote_flag, :vote_scope, :vote_ip end belongs_to :votable, :polymorphic => true belongs_to :voter, :polymorphic => true scope :up, lambda { where(:vote_flag => true) } scope :down, lambda { where(:vote_flag => false) } scope :for_type, lambda { |klass| where(:votable_type => klass.to_s) } scope :by_type, lambda { |klass| where(:voter_type => klass.to_s) } validates_presence_of :votable_id validates_presence_of :voter_id end end end
Version data entries
8 entries across 8 versions & 1 rubygems