Module: Badgeable::Adapters::ActiveRecordAdapter

Extended by:
ActiveSupport::Concern
Defined in:
lib/badgeable/adapters/active_record_adapter.rb

Class Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/badgeable/adapters/active_record_adapter.rb', line 6

def self.included(receiver)
  receiver.class_eval %Q{ 
    has_many :badgings
    has_many :badges, :through => :badgings
  }
  
  Badging.class_eval %Q{
    belongs_to :#{receiver.to_s.underscore}
  }
  
  Badge.class_eval %Q{
    has_many :badgings
    has_many :#{receiver.to_s.tableize}, :through => :badgings
  }
end