Class: Api::V1::ProductsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Api::V1::ProductsController
- Includes:
- Gemgento::Api::V1::Base, Gemgento::Api::V1::ProductFilters
- Defined in:
- app/controllers/gemgento/api/v1/products_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/gemgento/api/v1/products_controller.rb', line 6 def index if params[:category_id] @products = Gemgento::Category.find(params[:category_id]).products(current_store) else @products = current_store.products.order(:id) end @products = @products.where(basic_filters) @products = @products.filter(attribute_filters, current_store) if attribute_filters.any? @products = @products.page(@page[:number]).per(@page[:size]) end |