Class: Dscf::Marketplace::ProductsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Dscf::Marketplace::ProductsController
- Includes:
- Core::Common
- Defined in:
- app/controllers/dscf/marketplace/products_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#bypass_permissions_for_demo?, #pundit_user
Instance Method Details
#filter ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/dscf/marketplace/products_controller.rb', line 6 def filter @clazz.new, :filter? products = @clazz.all # Apply Ransack filtering if q params present if params[:q].present? products = products.ransack(params[:q]).result end # Apply eager loading products = products.includes(eager_loaded_associations) if eager_loaded_associations.present? # Add serializer includes includes = serializer_includes_for_action(:index) = {} [:include] = includes if includes.present? render_success(data: products, serializer_options: ) end |