Class: Spree::Core::CurrentStore

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/current_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ CurrentStore

Returns a new instance of CurrentStore



7
8
9
# File 'lib/spree/core/current_store.rb', line 7

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:



15
16
17
18
19
20
21
# File 'lib/spree/core/current_store.rb', line 15

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