class Stall::ProductFilters::PropertyFilter

Attributes

property[R]

Public Class Methods

new(*) click to toggle source
Calls superclass method Stall::ProductFilters::BaseFilter::new
# File lib/stall/product_filters/property_filter.rb, line 6
def initialize(*)
  super
  @property = options[:property]
end

Public Instance Methods

available?() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 11
def available?
  @available ||= (options[:force] || collection.count > 1)
end
collection() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 27
def collection
  @collection ||= property.property_values.joins(variants: :product)
    .where(stall_products: { id: products.select(:id) })
    .distinct
end
label() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 19
def label
  property.name
end
name() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 15
def name
  property.name.parameterize
end
param() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 23
def param
  :variants_property_values_id_in
end
partial_locals() click to toggle source
# File lib/stall/product_filters/property_filter.rb, line 33
def partial_locals
  { filter: self, property: property }
end