Module: AASM::Persistence::OhmPersistence
- Defined in:
- lib/aasm/persistence/ohm_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
def before_create
aasm_ensure_initial_state
end
As a result, you need to call super if you are going to define before_create yourself
class Foo < Ohm::Model
include AASM
include AASM::Persistence::OhmPersistence
def before_create
super
# your code here
end
end
30 31 32 33 34 35 |
# File 'lib/aasm/persistence/ohm_persistence.rb', line 30 def self.included(base) base.send(:include, AASM::Persistence::Base) base.extend AASM::Persistence::OhmPersistence::ClassMethods base.send(:include, Ohm::Callbacks) base.send(:include, AASM::Persistence::OhmPersistence::InstanceMethods) end |