Module: Votes::ActiveRecordExt
- Defined in:
- lib/votes/active_record_ext.rb
Defined Under Namespace
Modules: VoteableInstanceMethods, VoterInstanceMethods
Instance Method Summary
collapse
Instance Method Details
#be_voteable ⇒ Object
2
3
4
5
|
# File 'lib/votes/active_record_ext.rb', line 2
def be_voteable
has_many :votes, :as => :voteable, :dependent => :destroy
include VoteableInstanceMethods
end
|
#be_voter(args = {power:1}) ⇒ Object
7
8
9
10
11
|
# File 'lib/votes/active_record_ext.rb', line 7
def be_voter args={power:1}
@voter_power_of_vote = args[:power]
has_many :voter_votes, :class_name => 'Vote', :foreign_key => :user_id, :dependent => :destroy
include VoterInstanceMethods
end
|