Class: Merit::BadgesSash

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Merit::Base::BadgesSash, Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/merit/models/mongoid/merit/badges_sash.rb,
lib/merit/models/active_record/merit/badges_sash.rb

Class Method Summary collapse

Methods included from Merit::Base::BadgesSash

#badge

Class Method Details

.last_granted(options = {}) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/merit/models/mongoid/merit/badges_sash.rb', line 14

def self.last_granted(options = {})
  options[:since_date] ||= 1.month.ago
  options[:limit]      ||= 10
  where(:created_at.lte => options[:since_date])
    .limit(options[:limit])
    .map(&:badge)
end