Module: TreasureData::Logger::Agent::Rails::ModelExtension
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/td/logger/agent/rails/model.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.included(mod) ⇒ Object
Rails 2.
- .init ⇒ Object
Class Method Details
.included(mod) ⇒ Object
Rails 2
21 22 23 24 25 26 27 28 |
# File 'lib/td/logger/agent/rails/model.rb', line 21 def self.included(mod) im = InstanceMethods cm = ClassMethods mod.class_eval do include im extend cm end end |
.init ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/td/logger/agent/rails/model.rb', line 6 def self.init # disable model extension ActiveRecord is not loaded # on Rails > 3 (other ORM is used) if !defined?(::ActiveRecord) && ::Rails.respond_to?(:version) && ::Rails.version =~ /^3/ return end require 'active_record' ::ActiveRecord::Base.send(:include, self) end |