Class: Spree::Current

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
app/models/spree/current.rb

Instance Method Summary collapse

Instance Method Details

#currencyObject



9
10
11
# File 'app/models/spree/current.rb', line 9

def currency
  super || store&.default_currency
end

#global_pricing_contextObject



24
25
26
27
28
29
30
31
32
# File 'app/models/spree/current.rb', line 24

def global_pricing_context
  super || begin
    self.global_pricing_context = Spree::Pricing::Context.new(
      currency: currency,
      store: store,
      zone: zone
    )
  end
end

#price_listsObject



17
18
19
20
21
22
# File 'app/models/spree/current.rb', line 17

def price_lists
  super || begin
    context = global_pricing_context
    self.price_lists = Spree::PriceList.for_context(context)
  end
end

#storeObject



5
6
7
# File 'app/models/spree/current.rb', line 5

def store
  super || Spree::Store.default
end

#zoneObject



13
14
15
# File 'app/models/spree/current.rb', line 13

def zone
  super || Spree::Zone.default_tax || store&.checkout_zone
end