Sha256: f3cc8684ed9fcca065681ed55bbd38f06093f3bbb39210484c452de02fe1ab3a
Contents?: true
Size: 313 Bytes
Versions: 7
Compression:
Stored size: 313 Bytes
Contents
module Ratable class RatingAverage include ActiveModel::Model attr_accessor :ratings, :value, :rater, :ratee def initialize(attributes={}) attributes.reject! { |k| k == :value } attributes.each { |k,v| send("#{k}=", v) } @value = @ratings.average(:value).to_i end end end
Version data entries
7 entries across 7 versions & 1 rubygems