# Categories logic goes here
class CategoryController < ShopController
  def show
    @category = Category.where('slug = ?', params[:id]).first
    raise_404(@category)
    @category.ancestors.reverse!.each do |ancestor|
      if ancestor.id != 1
        add_breadcrumb ancestor.name, "/category/#{ancestor.slug}"
      end
    end
    add_breadcrumb @category.name, "/category/#{@category.slug}"
    @products = @category.active_products.page(params[:page])
  end
end
