Sha256: 572bcad8ce3b66521b15196ae4b02916f904f49e6eb84114ab6ae1cc0be62af6

Contents?: true

Size: 999 Bytes

Versions: 44

Compression:

Stored size: 999 Bytes

Contents

module Comee
  module Core
    class ProductLookupsController < ApplicationController
      include Common

      def index
        super do
          ProductLookup.includes(:product).all
        end
      end

      def fetch_one
        lookup = ProductLookup.includes(:product)
                              .find_by(
                                itemable_id: params[:id],
                                itemable_type: "Comee::Core::Client",
                                product_id: fetch_one_params[:product_id]
                              )
        render_content(lookup)
      end

      def filter
        data = ProductLookup.includes(:product, :itemable).ransack(params[:q]).result
        render_content(data)
      end

      private

      def fetch_one_params
        params.permit(:product_id)
      end

      def model_params
        params.required(:payload).permit(:code, :itemable_id, :itemable_type, :item_description, :product_id, :aliases)
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
comee_core-0.3.39 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.38 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.37 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.36 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.35 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.34 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.33 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.32 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.31 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.30 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.29 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.28 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.27 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.26 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.25 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.24 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.23 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.22 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.21 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.20 app/controllers/comee/core/product_lookups_controller.rb