Sha256: c763b12873ba4e2568bc8873e94e1af2cc42468a437a144d69b9b87e26e815c4

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

# A rating of a particular record.  Ratings consist of three components:
# * +rater+ - The person who is actually creating the rating
# * +ratable+ - The object which is being rated
# * +value+ - The value being assigned to the rating
# 
# *Note* that the value does not represent the actual integer value, but rather
# the enumeration record in the RatingValue model.
class Rating < ActiveRecord::Base
  belongs_to :rater, :polymorphic => true
  belongs_to :ratable, :polymorphic => true
  belongs_to :value, :class_name => 'RatingValue'
  
  validates_presence_of :rater_id, :rater_type, :ratable_id, :ratable_type,
                        :value_id
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
pluginaweek-has_ratings-0.3.0 app/models/rating.rb
has_ratings-0.3.1 app/models/rating.rb
has_ratings-0.3.0 app/models/rating.rb