Class: Gemgento::CategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/gemgento/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
# File 'app/controllers/gemgento/categories_controller.rb', line 7

def index
  @current_category = Category.root
  @categories = Category.top_level
end

#showObject



12
13
14
15
16
17
# File 'app/controllers/gemgento/categories_controller.rb', line 12

def show
  @current_category = Gemgento::Category.active.find_by!('id = ? OR url_key = ?', params[:id], params[:id])
  @products = current_category.products.active.catalog_visible
  @products = @products.filter(@filters) unless @filters.empty?
  @products = @products.page(params[:page]).per(params[:per])
end