Module: AASM::Persistence::NoBrainerPersistence
- Defined in:
- lib/aasm/persistence/no_brainer_persistence.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
This method:.
Class Method Details
.included(base) ⇒ Object
This method:
-
extends the model with ClassMethods
-
includes InstanceMethods
Adds
before_validation :aasm_ensure_initial_state
As a result, it doesn’t matter when you define your methods - the following 2 are equivalent
class Foo
include NoBrainer::Document
def aasm_write_state(state)
"bar"
end
include AASM
end
class Foo
include NoBrainer::Document
include AASM
def aasm_write_state(state)
"bar"
end
end
32 33 34 35 36 37 38 39 |
# File 'lib/aasm/persistence/no_brainer_persistence.rb', line 32 def self.included(base) base.send(:include, AASM::Persistence::Base) base.send(:include, AASM::Persistence::ORM) base.send(:include, AASM::Persistence::NoBrainerPersistence::InstanceMethods) base.extend AASM::Persistence::NoBrainerPersistence::ClassMethods base.after_initialize :aasm_ensure_initial_state end |