Class: Gaku::StatesListController

Inherits:
GakuController show all
Defined in:
app/controllers/gaku/states_list_controller.rb

Instance Method Summary collapse

Methods inherited from GakuController

#resolve_layout

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/gaku/states_list_controller.rb', line 5

def index
  if params[:country_id]
    @country = Country.find(params[:country_id])
    @states = State.where(country_iso: @country.iso)
    if params[:state_id]
      @state = State.find(params[:state_id])
    else
      @state = Preset.state
    end
  else
    @states = State.all
  end

  respond_with @states
end