Class: CountryStateSelect::CscsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CountryStateSelect::CscsController
- Defined in:
- app/controllers/country_state_select/cscs_controller.rb
Instance Method Summary collapse
-
#find_cities ⇒ Object
Send it a state_id and country_id; returns the cities of that state.
- #find_states ⇒ Object
Instance Method Details
#find_cities ⇒ Object
Send it a state_id and country_id; returns the cities of that state.
20 21 22 23 24 25 |
# File 'app/controllers/country_state_select/cscs_controller.rb', line 20 def find_cities render_cached( CountryStateSelect.collect_cities(params[:state_id], params[:country_id]), [params[:state_id], params[:country_id]] ) end |
#find_states ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/country_state_select/cscs_controller.rb', line 11 def find_states # `[[code, name], ...]` shape — the front-end uses element 0 as the option # value (ISO code) and element 1 as the label. Goes through the # configured data source (not `CS` directly) so a custom adapter and # only/except/priority filtering apply here too. render_cached(CountryStateSelect.raw_states(params[:country_id]), params[:country_id]) end |