hassox (owner)

Revisions

gist: 227560 Download_button fork
public
Public Clone URL: git://gist.github.com/227560.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
get '/geocode/:countryx/:cityx' do
  @geocodes = Geocode.where(:country_code => params[:countryx], :city => params[:cityx]).limit(10)
  codes = @geocodes.map do |g|
      g.to_json
  end
  if codes.empty?
    "{error : 'No Codes Found', status : 404}"
  else
    codes.join("\n")
  end
end