6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/pilgrim/tags_controller.rb', line 6
def change_location
@block = params[:block]
@kind = params[:kind]
@form_name = params[:form_name]
@city_name = params[:city_name]
@city_html_class = params[:city_html_class]
value = params[:value]
@states = nil
@cities = nil
if @kind == "country"
@state_name = params[:state_name]
@state_html_class = params[:state_html_class]
country = Pilgrim::Country.find(value)
states = country.states rescue []
@states = transform_result(states, 0)
cities = states.first.cities rescue []
@cities = transform_result(cities, 0)
elsif @kind == "state"
state = Pilgrim::State.find(value)
cities = state.cities rescue []
@cities = transform_result(cities, 0)
end
end
|