Class: Spree::PriceType

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

Class Method Summary collapse

Class Method Details

.create_defaultObject



2
3
4
5
6
7
8
9
# File 'app/models/spree/price_type.rb', line 2

def self.create_default
  price_type = find_or_initialize_by(
    name: "Selling Price #{Spree::Config[:currency]}",
    code: 'selling'
  )
  price_type.default = true
  price_type.save!
end

.defaultObject



11
12
13
14
# File 'app/models/spree/price_type.rb', line 11

def self.default
  default = where(default: true).first
  default || create_default
end