Class: OrdersController

Inherits:
Spree::BaseController show all
Defined in:
app/controllers/orders_controller.rb

Instance Method Summary collapse

Methods inherited from Spree::BaseController

#access_forbidden, #default_title, #find_order, #initialize_extension_partials, #set_title, #title

Methods inherited from ApplicationController

#admin_created?

Methods included from EasyRoleRequirementSystem

included

Methods included from EasyRoleRequirementSystem::InstanceMethods

#included

Methods included from RoleRequirementSystem

included

Instance Method Details

#can_access?Boolean

Returns:

  • (Boolean)


58
59
60
61
62
# File 'app/controllers/orders_controller.rb', line 58

def can_access?
  return true unless order = load_object    
  session[:order_token] ||= params[:order_token]
  order.grant_access?(session[:order_token])
end

#destroyObject

override r_c default b/c we don’t want to actually destroy, we just want to clear line items



45
46
47
48
49
50
51
52
# File 'app/controllers/orders_controller.rb', line 45

def destroy
  flash[:notice] = I18n.t(:basket_successfully_cleared)
  @order.line_items.clear
  @order.update_totals!
  after :destroy
  set_flash :destroy
  response_for :destroy
end