- browsing by subcategory
This commit is contained in:
18
front-api/controllers/sub_category.rb
Normal file
18
front-api/controllers/sub_category.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
get '/subcategory' do
|
||||
SubCategory
|
||||
.eager_load(category: :section)
|
||||
.order(:order)
|
||||
.all
|
||||
.to_json(:include => [filter_criterias: {include: :filter_criteria_values}, category: {include: :section} ])
|
||||
end
|
||||
|
||||
get '/subcategory/:id' do
|
||||
id = params[:id].to_i
|
||||
|
||||
SubCategory
|
||||
.eager_load(category: :section)
|
||||
.order(:order)
|
||||
.find(id)
|
||||
.to_json(:include => [filter_criterias: {include: :filter_criteria_values}, category: {include: :section} ])
|
||||
end
|
||||
Reference in New Issue
Block a user