Class: Spree::StoreController

Inherits:
ApplicationController
  • Object
show all
Includes:
Core::ControllerHelpers::Auth, Core::ControllerHelpers::Currency, Core::ControllerHelpers::Locale, Core::ControllerHelpers::Order, Core::ControllerHelpers::Search, Core::ControllerHelpers::Store, Core::ControllerHelpers::StrongParameters, LocaleUrls
Defined in:
app/controllers/spree/store_controller.rb

Instance Method Summary collapse

Instance Method Details



28
29
30
31
# File 'app/controllers/spree/store_controller.rb', line 28

def 
  render partial: 'spree/shared/link_to_account'
  fresh_when(etag: [try_spree_current_user, I18n.locale])
end

#api_tokensObject



38
39
40
41
42
43
# File 'app/controllers/spree/store_controller.rb', line 38

def api_tokens
  render json: {
    order_token: simple_current_order&.token,
    oauth_token: current_oauth_token&.token
  }
end


33
34
35
36
# File 'app/controllers/spree/store_controller.rb', line 33

def cart_link
  render partial: 'spree/shared/link_to_cart'
  fresh_when(etag: [simple_current_order, I18n.locale])
end

#ensure_cartObject



45
46
47
# File 'app/controllers/spree/store_controller.rb', line 45

def ensure_cart
  render json: current_order(create_order_if_necessary: true) # force creation of order if doesn't exists
end