Sha256: 24c238215e9888b363ee299c5fe9a6c6a9b65ac41bae2280562ede6d1c2cc444

Contents?: true

Size: 323 Bytes

Versions: 4

Compression:

Stored size: 323 Bytes

Contents

module Ratable
  class Rating < ActiveRecord::Base
    belongs_to :ratee, polymorphic: true
    belongs_to :rater, polymorphic: true

    validates_presence_of :ratee, :value

    scope :by_ratee, -> (ratee) { where(ratee: ratee) }
    scope :by_rater, -> (rater) { where(rater: rater) }

    def average
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ratable-0.0.4 app/models/ratable/rating.rb
ratable-0.0.3 app/models/ratable/rating.rb
ratable-0.0.2 app/models/ratable/rating.rb
ratable-0.0.1 app/models/ratable/rating.rb