Module: Ballot::Sequel::ClassMethods
- Defined in:
- lib/ballot/sequel.rb
Overview
Class method extensions to Sequel::Model to support Ballot.
Instance Method Summary collapse
-
#acts_as_ballot(*types) ⇒ Object
This macro makes migrating from ActiveRecord to Sequel (mostly) painless.
-
#acts_as_ballot_votable ⇒ Object
A shorthand version of
acts_as_ballot :votable
. -
#acts_as_ballot_voter ⇒ Object
A shorthand version of
acts_as_ballot :voter
. -
#ballot_votable? ⇒ Boolean
Sequel::Model classes are not votable by default.
-
#ballot_voter? ⇒ Boolean
Sequel::Model classes are not voters by default.
Instance Method Details
#acts_as_ballot(*types) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ballot/sequel.rb', line 30 def acts_as_ballot(*types) types.each do |type| case type.to_s when 'votable' warn 'Prefer using the Sequel::Model plugin :ballot_votable directly.' plugin :ballot_votable when 'voter' warn 'Prefer using the Sequel::Model plugin :ballot_voter directly.' plugin :ballot_voter end end end |
#acts_as_ballot_votable ⇒ Object
A shorthand version of acts_as_ballot :votable
.
44 45 46 |
# File 'lib/ballot/sequel.rb', line 44 def acts_as_ballot_votable acts_as_ballot :votable end |
#acts_as_ballot_voter ⇒ Object
A shorthand version of acts_as_ballot :voter
.
49 50 51 |
# File 'lib/ballot/sequel.rb', line 49 def acts_as_ballot_voter acts_as_ballot :voter end |
#ballot_votable? ⇒ Boolean
Sequel::Model classes are not votable by default.
10 11 12 |
# File 'lib/ballot/sequel.rb', line 10 def ballot_votable? false end |
#ballot_voter? ⇒ Boolean
Sequel::Model classes are not voters by default.
15 16 17 |
# File 'lib/ballot/sequel.rb', line 15 def ballot_voter? false end |