Module: Stateful::ActiveRecord

Defined in:
lib/Stateful/ActiveRecord.rb,
lib/Stateful/ActiveRecord/ClassMethods.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object Also known as: included



19
20
21
22
23
24
# File 'lib/Stateful/ActiveRecord.rb', line 19

def extended(klass)
  klass.extend(Stateful::ClassMethods)
  klass.send(:include, Stateful::InstanceMethods)
  set_column_name(klass)
  klass.extend(Stateful::ActiveRecord::ClassMethods)
end

.set_column_name(klass) ⇒ Object



13
14
15
16
17
# File 'lib/Stateful/ActiveRecord.rb', line 13

def set_column_name(klass)
  unless klass.instance_variable_get(:@stateful_column_name)
    klass.instance_variable_set(:@stateful_column_name, 'current_state')
  end
end