Module: RailsRateable::ClassMethods
- Defined in:
- lib/app/models/rails_rateable.rb
Instance Method Summary collapse
- #find_top_rated(limit = nil) ⇒ Object
-
#rails_rateable(options = {}) ⇒ Object
put class method here to be trigger as say User.method_name.
Instance Method Details
#find_top_rated(limit = nil) ⇒ Object
17 18 19 20 |
# File 'lib/app/models/rails_rateable.rb', line 17 def find_top_rated(limit = nil) limit = 20 unless limit includes(:rating).order('ratings.average_rating DESC').limit(limit) end |
#rails_rateable(options = {}) ⇒ Object
put class method here to be trigger as say User.method_name
10 11 12 13 14 15 |
# File 'lib/app/models/rails_rateable.rb', line 10 def rails_rateable( = {}) unless respond_to?(:max_rating) class_attribute :max_rating self. = [:max_rating] || 5 end end |