Class: HandyLocationInputs::LocationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- HandyLocationInputs::LocationsController
- Includes:
- Locatable
- Defined in:
- app/controllers/handy_location_inputs/locations_controller.rb
Instance Method Summary collapse
Instance Method Details
#cities ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/handy_location_inputs/locations_controller.rb', line 16 def cities respond_to do |format| format.json {render json: { cities: CS.cities(state_key, country_key)}} end end |
#country_key ⇒ Object
22 23 24 |
# File 'app/controllers/handy_location_inputs/locations_controller.rb', line 22 def country_key CS.countries.key(params[:country]) end |
#state_key ⇒ Object
26 27 28 |
# File 'app/controllers/handy_location_inputs/locations_controller.rb', line 26 def state_key return_key(CS.states(country_key), params[:state]) end |
#states ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/handy_location_inputs/locations_controller.rb', line 10 def states respond_to do |format| format.json {render json: { states: CS.states(country_key).values }} end end |