Module: Workflow::StateDependentValidations::StateDependency
- Defined in:
- lib/workflow/state_dependent_validations.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/workflow/state_dependent_validations.rb', line 7 def self.included(base) base.send :alias_method_chain, :validate, :state_dependency end |
Instance Method Details
#validate_with_state_dependency(record) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/workflow/state_dependent_validations.rb', line 11 def validate_with_state_dependency(record) if not record.respond_to?(:current_state) or perform_validation_for_state?(record.current_state) or perform_validation_for_transition?(record.in_transition) or perform_validation_for_transition?("#{record.in_exit}_exit") or perform_validation_for_transition?("#{record.in_entry}_entry") validate_without_state_dependency(record) end end |