
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
