Module: AASM::Persistence::NContentRestPersistence
- Included in:
- NaranyaEcm::Content, NaranyaEcm::ContentVersion
- Defined in:
- lib/aasm/persistence/ncontent_rest_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, :on => :create
As a result, it doesn’t matter when you define your methods - the following 2 are equivalent
class Foo < ActiveRecord::Base def aasm_write_state(state) “bar” end include AASM end
class Foo < ActiveRecord::Base include AASM def aasm_write_state(state) “bar” end end
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/aasm/persistence/ncontent_rest_persistence.rb', line 29 def self.included(base) base.send(:include, AASM::Persistence::Base) base.extend AASM::Persistence::NContentRestPersistence::ClassMethods base.send(:include, AASM::Persistence::NContentRestPersistence::InstanceMethods) base.before_validation(:aasm_ensure_initial_state, :on => :create) # ensure initial aasm state even when validations are skipped base.before_create(:aasm_ensure_initial_state) # ensure state is in the list of states # base.validate :aasm_validate_states end |