

get '/category' do 
  Category.eager_load(:sub_categories).order('categories.order, sub_categories.order').all.to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values} ])
end

get '/category/:id' do 
  id = params[:id].to_i
  Category.eager_load(:sub_categories).order('sub_categories.order').find(id).to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values}])
end
