Module: Mongoid::Letsrate::ClassMethods

Defined in:
lib/mongoid/letsrate/model.rb

Instance Method Summary collapse

Instance Method Details

#letsrate_rateableObject



55
56
57
58
59
60
61
# File 'lib/mongoid/letsrate/model.rb', line 55

def letsrate_rateable
  has_many :rates, :as => :rateable, :class_name => 'Rate', :dependent => :destroy
  has_many :raters, class_name: 'User'

  has_one :average, :as => :cacheable,
          :class_name => 'RatingCache', :dependent => :destroy
end

#letsrate_raterObject



50
51
52
53
# File 'lib/mongoid/letsrate/model.rb', line 50

def letsrate_rater
  has_many :ratings_given, :class_name => 'Rate'
  belongs_to :rateable
end