class Merit::Models::ActiveRecord::Sash

Sash is a container for reputation data for meritable models. It's an indirection between meritable models and badges and scores (one to one relationship).

It's existence make join models like badges_users and scores_users unnecessary. It should be transparent at the application.

Public Instance Methods

score_points(options = {}) click to toggle source

Retrieve all points from a category or none if category doesn't exist By default retrieve all Points @param category [String] The category @return [ActiveRecord::Relation] containing the points

# File lib/merit/models/active_record/sash.rb, line 24
def score_points(options = {})
  scope = Merit::QalamScore::Point
            .joins(:score)
            .where('merit_scores.sash_id = ?', id)
  if (category = options[:category])
    scope = scope.where('merit_scores.category = ?', category)
  end
  scope
end