Sha256: 1644e576ad6065e00b11aee86b1095adabffa77d22bbce34f63e8e74ed3d106e

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

Spree::Product.class_eval do
  has_many :active_sale_events, :as => :eventable, :class_name => "Spree::ActiveSale::Event"

  def find_live_taxons
    Spree::ActiveSale::Event.live_active.where(:eventable_type => "Spree::Taxon", :eventable_id => self.taxons.map(&:id))
  end

  def live?
    !self.active_sale_events.detect{ |event| (event.live_and_active?) }.nil? || !self.find_live_taxons.blank?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_active_sale-1.0.6 app/models/spree/product_decorator.rb