Method: Spree::Variant.active

Defined in:
app/models/spree/variant.rb

.active(currency = nil) ⇒ ActiveRecord::Relation

Deprecated.

Please use the .with_prices scope instead

Returns variants that are not deleted and have a price in the given currency.



136
137
138
139
# File 'app/models/spree/variant.rb', line 136

def self.active(currency = nil)
  Spree::Deprecation.warn("`Variant.active(currency)` is deprecated. Please use `Variant.with_prices(pricing_options)` instead.", caller)
  joins(:prices).where(deleted_at: nil).where('spree_prices.currency' => currency || Spree::Config[:currency]).where('spree_prices.amount IS NOT NULL')
end