Class: Comee::Core::ProductsController
Instance Method Summary
collapse
Methods included from Common
#create, #update
Methods included from Pagination
#default_per_page, #order_by, #order_direction, #page_no, #paginate, #paginate_offset, #per_page
#application_code, #authenticate, #current_application, #current_user, #render_content, #render_error, #skip_bullet
Instance Method Details
#categories ⇒ Object
29
30
31
32
|
# File 'app/controllers/comee/core/products_controller.rb', line 29
def categories
root = Product.find_by(code: "root")
render_content(root.children)
end
|
#client_prices ⇒ Object
24
25
26
27
|
# File 'app/controllers/comee/core/products_controller.rb', line 24
def client_prices
data = ClientPrice.where(product_id: price_params[:product_ids])
render_content(data)
end
|
#customers ⇒ Object
34
35
36
37
38
|
# File 'app/controllers/comee/core/products_controller.rb', line 34
def customers
clients = ProductLookup.where(product_id: params[:id], itemable_type: "Comee::Core::Client")
.map(&:itemable)
render_content(clients)
end
|
#filter ⇒ Object
40
41
42
43
|
# File 'app/controllers/comee/core/products_controller.rb', line 40
def filter
data = Product.ransack(params[:q]).result
render_content(data)
end
|
#index ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/comee/core/products_controller.rb', line 6
def index
super do
Product.leafs
end
end
|
#master_prices ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/comee/core/products_controller.rb', line 18
def master_prices
data = MasterPrice.includes(:product_lookup, :supplier, :product)
.where(product_id: price_params[:product_ids])
render_content(data)
end
|
#show ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/comee/core/products_controller.rb', line 12
def show
super do
Comee::Core::Product.with_attached_images.find(params[:id])
end
end
|