Module: Workflow
- Defined in:
- lib/workflow_on_mongoid/workflow.rb
Defined Under Namespace
Modules: MongoidInstanceMethods
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/workflow_on_mongoid/workflow.rb', line 19 def self.included(klass) klass.send :include, WorkflowInstanceMethods klass.extend WorkflowClassMethods if Object.const_defined?(:ActiveRecord) && klass < ActiveRecord::Base klass.send :include, ActiveRecordInstanceMethods klass.before_validation :write_initial_state elsif Object.const_defined?(:Remodel) && klass < Remodel::Entity klass.send :include, RemodelInstanceMethods elsif Object.const_defined?(:Mongoid) && klass < Mongoid::Document klass.class_eval do klass.send :include, MongoidInstanceMethods klass.before_validation :write_initial_state end end end |