Class: Admin::OrdersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/orders_controller.rb

Instance Method Summary collapse

Instance Method Details

#fireObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/admin/orders_controller.rb', line 10

def fire   
  # TODO - possible security check here but right now any admin can before any transition (and the state machine 
  # itself will make sure transitions are not applied in the wrong state)
  event = params[:e]
  Order.transaction do 
    @order.state_events.create(:name => t(event), :user => current_user, :previous_state => @order.state)
    @order.send("#{event}!")
  end
  flash[:notice] = t('order_updated')
rescue Spree::GatewayError => ge
  flash[:error] = "#{ge.message}"
ensure
  redirect_to :back
end

#resendObject



25
26
27
28
29
# File 'app/controllers/admin/orders_controller.rb', line 25

def resend
  OrderMailer.deliver_confirm(@order, true)
  flash[:notice] = t('order_email_resent')
  redirect_to :back
end