Module: Lims::Core::Actions::ActionGroup::AfterEval
- Defined in:
- lib/lims-core/actions/action_group.rb
Overview
This module is needed otherwire the following methogs will be overriden by the mixin called in self.included.
Instance Method Summary collapse
- #_call_in_session(session) ⇒ Object
-
#execute_and_store_result(session, &after_save) ⇒ Object
We need to override call to process all the after_save once all actions have been executed.
-
#update_action_attribute(action) ⇒ Object
Set the required attribute of the children action to the parent one.
Instance Method Details
#_call_in_session(session) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/lims-core/actions/action_group.rb', line 34 def _call_in_session(session) actions.map do |action| update_action_attribute(action) action.with_session(session) do |new_session| action.execute_and_store_result(new_session) action.result end end end |
#execute_and_store_result(session, &after_save) ⇒ Object
We need to override call to process all the after_save once all actions have been executed
28 29 30 31 32 |
# File 'lib/lims-core/actions/action_group.rb', line 28 def execute_and_store_result(session, &after_save) after_save ||= lambda { |a,s| a.result } self.result = _call_in_session(session) lambda { after_save[self, session] } end |
#update_action_attribute(action) ⇒ Object
Set the required attribute of the children action to the parent one.
46 47 48 49 50 |
# File 'lib/lims-core/actions/action_group.rb', line 46 def update_action_attribute(action) %w(store user application).each do |attribute| action[attribute]=self[attribute] end end |