Class: Gaku::Admin::StatesController

Inherits:
BaseController show all
Defined in:
app/controllers/gaku/admin/states_controller.rb

Instance Method Summary collapse

Instance Method Details

#country_statesObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/gaku/admin/states_controller.rb', line 10

def country_states
  if params[:state][:country_iso].empty?
    states_for_default_country
  else
    @country = Country.where(iso: params[:state][:country_iso]).first
    @states = @country.states
    set_count @country
    respond_with @country
  end
end

#createObject



31
32
33
34
35
# File 'app/controllers/gaku/admin/states_controller.rb', line 31

def create
  @state = State.new(state_params)
  @state.save
  respond_with @state
end

#destroyObject



21
22
23
24
# File 'app/controllers/gaku/admin/states_controller.rb', line 21

def destroy
  @state.destroy
  respond_with @state
end

#editObject



37
38
# File 'app/controllers/gaku/admin/states_controller.rb', line 37

def edit
end

#indexObject



45
46
47
48
49
# File 'app/controllers/gaku/admin/states_controller.rb', line 45

def index
  @country = set_default_country
  set_count @country
  respond_with @country
end

#newObject



26
27
28
29
# File 'app/controllers/gaku/admin/states_controller.rb', line 26

def new
  @state = State.new
  respond_with @state
end

#updateObject



40
41
42
43
# File 'app/controllers/gaku/admin/states_controller.rb', line 40

def update
  @state.update(state_params)
  respond_with @state
end