Class: PowerShop::CatalogController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PowerShop::CatalogController
- Defined in:
- app/controllers/power_shop/catalog_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#category ⇒ Object
Public: show products inside current category.
-
#index ⇒ Object
Public: show all products with pagination.
-
#product ⇒ Object
Public: show detail page for product.
Methods inherited from ApplicationController
Instance Method Details
#category ⇒ Object
Public: show products inside current category
Returns: text/html
13 14 15 16 |
# File 'app/controllers/power_shop/catalog_controller.rb', line 13 def category @category = ::Category.friendly.find(params[:id]) @products = scoped_products.where(category: @category).page(params[:page]) end |
#index ⇒ Object
Public: show all products with pagination
Returns: text/html
6 7 8 |
# File 'app/controllers/power_shop/catalog_controller.rb', line 6 def index @products = scoped_products.page(params[:page]) end |
#product ⇒ Object
Public: show detail page for product
Returns text/html
21 22 23 24 |
# File 'app/controllers/power_shop/catalog_controller.rb', line 21 def product @category = ::Category.friendly.find(params[:category_id]) @product = scoped_products.friendly.find(params[:id]) end |