Class Offer
In: app/models/offer.rb
Parent: ActiveRecord::Base

Methods

Included Modules

Access::Controlled

Public Class methods

Set store_id before checking permission to set discount_pct

[Source]

    # File app/models/offer.rb, line 32
32:   def self.attribute_block_set_groups
33:     super + [['store', 'store_id']]
34:   end

Public Instance methods

[Source]

    # File app/models/offer.rb, line 48
48:   def price
49:     discount_pct.blank? ? product.price : 
50:       (product.price * (100 - discount_pct) / 100.0).round(2)
51:   end

[Validate]