Sha256: 6f92d816afab69eb0d56ca9f78da6c7118e31cb5fc1567201a90be92e7476d68

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

class ProductOffer < ActiveRecord::Base
  attr_protected :created_at, :updated_at

  tracks_created_by_updated_by

  belongs_to :product_offer_record, :polymorphic => true

  def valid_from=(date)
    if date.is_a? String
      write_attribute(:valid_from, date.to_date)
    else
      super
    end
  end

  def valid_to=(date)
    if date.is_a? String
      write_attribute(:valid_to, date.to_date)
    else
      super
    end
  end

  def after_destroy
    if self.product_offer_record && !self.product_offer_record.frozen?
      self.product_offer_record.destroy
    end 
  end

  def taxable?
    self.product_offer_record.taxable?
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_products-4.2.0 app/models/product_offer.rb