Class: Spree::CurrentStoreSelector

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/current_store_selector.rb

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ CurrentStoreSelector

Returns a new instance of CurrentStoreSelector



6
7
8
# File 'app/models/spree/current_store_selector.rb', line 6

def initialize(request)
  @request = request
end

Instance Method Details

#storeSpree::Store

Chooses the current store based on a request. Checks request headers for HTTP_SPREE_STORE and falls back to looking up by the requesting server's name.

Returns:



14
15
16
17
18
19
20
# File 'app/models/spree/current_store_selector.rb', line 14

def store
  if store_key
    Spree::Store.current(store_key)
  else
    Spree::Store.default
  end
end