Class: Spree::Admin::Orders::CustomerDetailsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/orders/customer_details_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



12
13
14
15
16
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 12

def edit
  country_id = Address.default.country.id
  @order.build_bill_address(:country_id => country_id) if @order.bill_address.nil?
  @order.build_ship_address(:country_id => country_id) if @order.ship_address.nil?
end

#showObject



7
8
9
10
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 7

def show
  edit
  render :action => :edit
end

#updateObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 18

def update
  if @order.update_attributes(params[:order])
    while @order.next; end

    @order.shipments.map &:refresh_rates
    flash[:success] = Spree.t('customer_details_updated')
    redirect_to admin_order_customer_path(@order)
  else
    render :action => :edit
  end

end