Class: Gaku::StatesController

Inherits:
CoreController
  • Object
show all
Defined in:
app/controllers/gaku/states_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/gaku/states_controller.rb', line 6

def index
  if params[:country_id]
    @country = Country.find(params[:country_id])
    @states = State.where(country_iso: @country.iso)
                   .order('name asc')
  else
    @states = State.all
  end

  respond_with @states
end