Module: Badgeable::Adapters::ActiveRecordAdapter

Extended by:
ActiveSupport::Concern
Defined in:
lib/badgeable_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
# File 'lib/badgeable_active_record/adapter.rb', line 6

def self.included(receiver)
  receiver.class_eval %Q{ 
    has_many :badgings, :as => :subject
    has_many :badges, :through => :badgings
  }
  
  
  Badge.class_eval %Q{
    has_many :#{receiver.to_s.tableize}, :through => :badgings, :source => :subject, :source_type => "#{receiver.to_s.camelize}"
  }
end