Sha256: baef5a0f073c48b4d27037fa2e098620966a18818a616fcc34dfa4368b6d0dbe

Contents?: true

Size: 830 Bytes

Versions: 14

Compression:

Stored size: 830 Bytes

Contents

require 'redmine_crm/helpers/vote_helper'

module RedmineCrm
  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
      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) }
      scope :by_type,  lambda{ |klass| where(:voter_type => klass) }

      validates_presence_of :votable_id
      validates_presence_of :voter_id

    end

  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
test_redmine_vz-0.0.24 lib/redmine_crm/vote.rb
redmine_crm-0.0.23 lib/redmine_crm/vote.rb
redmine_crm-0.0.22 lib/redmine_crm/vote.rb
redmine_crm-0.0.21 lib/redmine_crm/vote.rb
redmine_crm-0.0.20 lib/redmine_crm/vote.rb
redmine_crm-0.0.19 lib/redmine_crm/vote.rb
redmine_crm-0.0.18 lib/redmine_crm/vote.rb
redmine_crm-0.0.17 lib/redmine_crm/vote.rb
redmine_crm-0.0.16 lib/redmine_crm/vote.rb
redmine_crm-0.0.14 lib/redmine_crm/vote.rb
redmine_crm-0.0.13 lib/redmine_crm/vote.rb
redmine_crm-0.0.12 lib/redmine_crm/vote.rb
redmine_crm-0.0.11 lib/redmine_crm/vote.rb
redmine_crm-0.0.10 lib/redmine_crm/vote.rb