Class: Badge

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/badgeable/adapters/active_record_adapter.rb,
lib/badgeable/adapters/mongoid_adapter/badge.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_or_create_by_name(name, options) ⇒ Object



36
37
38
# File 'lib/badgeable/adapters/active_record_adapter.rb', line 36

def self.find_or_create_by_name(name)
  Badge.where(:name => name).first || create(:name => name)
end

Instance Method Details

#iconObject



40
41
42
# File 'lib/badgeable/adapters/active_record_adapter.rb', line 40

def icon
  "/images/#{name.parameterize}.jpg"
end