Module: IsRateable::ActsAsRater::LocalInstanceMethods
- Defined in:
- lib/is_rateable/acts_as_rater.rb
Instance Method Summary collapse
-
#rated_any? ⇒ Boolean
Has this object rated anything yet?.
-
#rating_for(ratee) ⇒ Object
Return the objects rating for another object.
Instance Method Details
#rated_any? ⇒ Boolean
Has this object rated anything yet?
19 20 21 |
# File 'lib/is_rateable/acts_as_rater.rb', line 19 def rated_any? .any? end |
#rating_for(ratee) ⇒ Object
Return the objects rating for another object
24 25 26 27 |
# File 'lib/is_rateable/acts_as_rater.rb', line 24 def (ratee) return nil unless .where(ratee: ratee).first ((.where(ratee: ratee).average(:score) * 10).round / 10.0) end |