Module: FormalVote::ActsAsVoter::ClassMethods
- Defined in:
- lib/acts_as_voter.rb
Instance Method Summary collapse
Instance Method Details
#acts_as_voter ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/acts_as_voter.rb', line 9 def acts_as_voter # If a voting entity is deleted, keep the votes. # If you want to nullify (and keep the votes), you'll need to remove # the unique constraint on the [ voter, voteable ] index in the database. # has_many :votes, :as => :voter, :dependent => :nullify # Destroy voter's votes when the voter is deleted. has_many FormalVote.configuration[:voter_relationship_name], :as => :voter, :dependent => :destroy, :class_name => 'Vote' include FormalVote::ActsAsVoter::InstanceMethods extend FormalVote::ActsAsVoter::SingletonMethods end |