Module: ActiveRecordInclude::WhenInherited::ClassMethods

Defined in:
lib/active_record_include/when_inherited.rb

Instance Method Summary collapse

Instance Method Details

#include_recursively(mod) ⇒ Object



23
24
25
26
# File 'lib/active_record_include/when_inherited.rb', line 23

def include_recursively(mod)
  include               mod
  include_in_subclasses mod
end

#include_when_inherited(mod) ⇒ Object Also known as: include_in_subclasses



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_record_include/when_inherited.rb', line 8

def include_when_inherited(mod)
  self.class_eval do
    unless    defined?(modules_to_include_when_inherited)
      class_attribute :modules_to_include_when_inherited
    end
  end
  #puts %(#{self}.modules_to_include_when_inherited=#{self.modules_to_include_when_inherited.inspect})
  self.modules_to_include_when_inherited ||= []
  self.modules_to_include_when_inherited  |= [mod]
  unless self < OnInherit
    include     OnInherit
  end
end