Class: Comee::Core::ProductLookupsController

Inherits:
ApplicationController show all
Includes:
Common
Defined in:
app/controllers/comee/core/product_lookups_controller.rb

Instance Method Summary collapse

Methods included from Common

#create, #show, #update

Methods included from Pagination

#default_per_page, #order_by, #order_direction, #page_no, #paginate, #paginate_offset, #per_page

Methods inherited from ApplicationController

#application_code, #authenticate, #current_application, #current_user, #render_content, #render_error, #skip_bullet

Instance Method Details

#fetch_oneObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/comee/core/product_lookups_controller.rb', line 12

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

#filterObject



22
23
24
25
26
27
28
# File 'app/controllers/comee/core/product_lookups_controller.rb', line 22

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

#indexObject



6
7
8
9
10
# File 'app/controllers/comee/core/product_lookups_controller.rb', line 6

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