Class: Stall::ProductFilters::CategoryFilter
- Inherits:
-
BaseFilter
- Object
- BaseFilter
- Stall::ProductFilters::CategoryFilter
show all
- Defined in:
- lib/stall/product_filters/category_filter.rb
Instance Attribute Summary
Attributes inherited from BaseFilter
#options, #products
Instance Method Summary
collapse
Methods inherited from BaseFilter
#initialize, #key, #label, #name, #partial_locals, #partial_path, #rendering_options
Instance Method Details
#available? ⇒ Boolean
4
5
6
|
# File 'lib/stall/product_filters/category_filter.rb', line 4
def available?
options[:force] || collection.count > 1
end
|
#collection ⇒ Object
8
9
10
11
12
|
# File 'lib/stall/product_filters/category_filter.rb', line 8
def collection
@collection ||= ProductCategory.joins(:products)
.where(stall_products: { id: products.select(:id) })
.distinct
end
|
#param ⇒ Object
14
15
16
|
# File 'lib/stall/product_filters/category_filter.rb', line 14
def param
:"#{ param_with_parents }_in"
end
|