Module: Uncouple::ActionPerformer
- Defined in:
- lib/uncouple/action_performer.rb
Instance Method Summary collapse
Instance Method Details
#perform(action_class, action_params = nil, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/uncouple/action_performer.rb', line 4 def perform(action_class, action_params=nil, &block) action_params ||= params if respond_to?(:params) action_params.merge!(current_user: current_user) if respond_to?(:current_user) if @action = action_class.new(action_params) @action. block.call if block_given? && @action.success? end @action end |