Module: Mongoid::Voteable::ClassMethods

Defined in:
lib/voteable_mongoid/voteable.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) voteable(klass = self, options = nil)

Set vote point for each up (down) vote on an object of this class

voteable self, :up => 1, :down => -3 voteable Post, :up => 2, :down => -1, :update_counters => false # skip counter update



46
47
48
49
50
51
52
# File 'lib/voteable_mongoid/voteable.rb', line 46

def voteable(klass = self, options = nil)
  VOTEABLE[name] ||= {}
  VOTEABLE[name][klass.name] ||= options
  if klass != self
    VOTEABLE[name][name][:update_parents] = true
  end
end