13 lines
278 B
Ruby
13 lines
278 B
Ruby
|
module CategoryFilter
|
||
|
extend ActiveSupport::Concern
|
||
|
|
||
|
included do
|
||
|
scope :all_category, where(type: name.to_s)
|
||
|
end
|
||
|
|
||
|
# module ClassMethods
|
||
|
# def filter_by_category(category_id)
|
||
|
# product_"#{name}" = name.where(category_id: category_id)
|
||
|
# end
|
||
|
# end
|
||
|
end
|