Sha256: 4495f458d8207db9f165ec1501fe93a65a154d43b803ef2eeab2fa279b03bd62

Contents?: true

Size: 988 Bytes

Versions: 10

Compression:

Stored size: 988 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).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

10 entries across 10 versions & 1 rubygems

Version Path
comee_core-0.3.15 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.14 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.13 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.12 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.11 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.10 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.9 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.8 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.7 app/controllers/comee/core/product_lookups_controller.rb
comee_core-0.3.6 app/controllers/comee/core/product_lookups_controller.rb