Class: Gaku::Admin::StatesController
- Inherits:
-
BaseController
- Object
- CoreController
- BaseController
- Gaku::Admin::StatesController
- Defined in:
- app/controllers/gaku/admin/states_controller.rb
Instance Method Summary collapse
- #country_states ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#country_states ⇒ Object
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 |
#create ⇒ Object
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 |
#destroy ⇒ Object
21 22 23 24 |
# File 'app/controllers/gaku/admin/states_controller.rb', line 21 def destroy @state.destroy respond_with @state end |
#edit ⇒ Object
37 38 |
# File 'app/controllers/gaku/admin/states_controller.rb', line 37 def edit end |
#index ⇒ Object
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 |
#new ⇒ Object
26 27 28 29 |
# File 'app/controllers/gaku/admin/states_controller.rb', line 26 def new @state = State.new respond_with @state end |
#update ⇒ Object
40 41 42 43 |
# File 'app/controllers/gaku/admin/states_controller.rb', line 40 def update @state.update(state_params) respond_with @state end |