updated json format for location and locaiton categories

This commit is contained in:
saurabhbhatia 2013-10-03 17:59:12 +08:00
parent 44f5a98a69
commit fea0540ec3
2 changed files with 4 additions and 5 deletions

View File

@ -43,10 +43,10 @@ class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendContr
I18n.locale = :zh_tw
name_zh_tw = category.name
category_id = category.id.to_s
@data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category_id, location_link: "http://ntue.tp.rulingcom.com/panel/location/back_end/locations/get_categorywise_locations?category_id[]=#{category_id}"}
@data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category_id, location_link: "http://ntue.tp.rulingcom.com/panel/location/back_end/locations/get_categorywise_locations?category_id=#{category_id}"}
end
render :json => JSON.pretty_generate({location_category: @data})
render :json => JSON.pretty_generate(@data)
end
end

View File

@ -75,8 +75,7 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
end
def get_categorywise_locations
@category_id = params[:category_id].first
location_infos = LocationInfo.where(:location_category_id => @category_id)
location_infos = LocationInfo.where(:location_category_id => params[:category_id])
@data = Array.new
location_infos.each do |location|
@ -92,6 +91,6 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
description: location.description }
end
render :json => JSON.pretty_generate({location: @data})
render :json => JSON.pretty_generate(@data)
end
end