Module: MongoMapper::Plugins::Voteable
- Defined in:
- lib/mongo_mapper/plugins/voteable.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.configure(model) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mongo_mapper/plugins/voteable.rb', line 7 def self.configure(model) model.class_eval do key :votes_count, Integer, :default => 0 key :votes_average, Integer, :default => 0 key :voter_ids, Array, :typecast => 'ObjectId' many :votes, :as => 'voteable', :dependent => :destroy def voteable?; true; end end end |