Module: EntityStatus::InstanceMethods
- Defined in:
- lib/entity_status.rb
Instance Method Summary collapse
Instance Method Details
#dependant_state_update(state) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/entity_status.rb', line 74 def dependant_state_update(state) self.update_attributes status: state self.reflections.each do |rel| if rel.last.klass.method_defined? :dependant_state_update if rel.last.[:dependent] == :destroy items = [] + self.send(rel.last.name) items.each do |item| item.dependant_state_update state end end end end end |