Class: Spree::Admin::ReturnAuthorizationsController

Inherits:
ResourceController show all
Defined in:
app/controllers/spree/admin/return_authorizations_controller.rb

Instance Method Summary collapse

Methods inherited from ResourceController

belongs_to, #create, #destroy, #edit, #new, #update, #update_positions

Instance Method Details

#fireObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/spree/admin/return_authorizations_controller.rb', line 12

def fire
  action_from_params = "#{params[:e]}!"

  if @return_authorization.state_events.include?(params[:e].to_sym) &&
     @return_authorization.send(action_from_params)

    flash_message = { success: t('spree.return_authorization_updated') }
  else
    flash_message = { error: t('spree.return_authorization_fire_error') }
  end

  redirect_back(fallback_location: admin_order_return_authorizations_path(@order),
                flash: flash_message)
end