Module: Mongoid::Letsrate::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#letsrate_rateableObject



75
76
77
78
79
80
81
# File 'lib/mongoid/letsrate/model.rb', line 75

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



69
70
71
72
73
# File 'lib/mongoid/letsrate/model.rb', line 69

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