Class: Cats::Core::CommodityCategoriesController
Instance Method Summary
collapse
Methods included from Common
#create, #show, #update
#authenticate, #current_user, #skip_bullet
Instance Method Details
#all ⇒ Object
12
13
14
15
|
# File 'app/controllers/cats/core/commodity_categories_controller.rb', line 12
def all
data = CommodityCategory.all
render json: {success: true, data: data}
end
|
#children ⇒ Object
22
23
24
25
|
# File 'app/controllers/cats/core/commodity_categories_controller.rb', line 22
def children
parent = CommodityCategory.find(params[:id])
render json: {success: true, data: serialize(parent.children)}
end
|
#index ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/cats/core/commodity_categories_controller.rb', line 6
def index
super do
CommodityCategory.all.reject(&:has_children?)
end
end
|
#root ⇒ Object
17
18
19
20
|
# File 'app/controllers/cats/core/commodity_categories_controller.rb', line 17
def root
data = CommodityCategory.roots
render json: {success: true, data: serialize(data)}
end
|