Class: Spree::Admin::RefundsController

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

Instance Method Summary collapse

Methods inherited from ResourceController

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

Instance Method Details

#createObject



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

def create
  @refund.attributes = refund_params

  if @refund.valid? && @refund.perform!
    flash[:success] = flash_message_for(@refund, :successfully_created)
    respond_with(@refund) do |format|
      format.html { redirect_to location_after_save }
    end
  else
    flash.now[:error] = @refund.errors.full_messages.join(", ")
    respond_with(@refund) do |format|
      format.html { render action: 'new' }
    end
  end
end