Module: Stall::Models::Product

Extended by:
ActiveSupport::Concern
Included in:
Product
Defined in:
app/models/stall/models/product.rb

Instance Method Summary collapse

Instance Method Details

#image(*args) ⇒ Object



53
54
55
56
57
# File 'app/models/stall/models/product.rb', line 53

def image(*args)
  if (image = images.first)
    image.file
  end
end

#image?Boolean

Support paperclip attachment presence helper for #image

Returns:

  • (Boolean)


60
61
62
# File 'app/models/stall/models/product.rb', line 60

def image?
  !!image
end

#priceObject



49
50
51
# File 'app/models/stall/models/product.rb', line 49

def price
  variants.map(&:price).min
end

#vat_rateObject



45
46
47
# File 'app/models/stall/models/product.rb', line 45

def vat_rate
  Stall.config.vat_rate
end