Class: Stay::Admin::StatesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- Stay::ApplicationController
- BaseController
- Stay::Admin::StatesController
- Defined in:
- app/controllers/stay/admin/states_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /admin/countries/:country_id/states.
-
#destroy ⇒ Object
DELETE /admin/countries/:country_id/states/:id.
-
#edit ⇒ Object
GET /admin/countries/:country_id/states/:id/edit.
-
#index ⇒ Object
GET /admin/countries/:country_id/states.
-
#new ⇒ Object
GET /admin/countries/:country_id/states/new.
-
#show ⇒ Object
GET /admin/countries/:country_id/states/:id.
-
#update ⇒ Object
PATCH/PUT /admin/countries/:country_id/states/:id.
Methods inherited from BaseController
#load_stores, #set_currency, #set_current_store, #stores_scope
Methods included from ControllerHelpers::Store
#current_store, #ensure_current_store, #store_locale
Methods included from ControllerHelpers::Currency
#currency_param, #current_currency, #supported_currencies, #supported_currencies_for_all_stores, #supported_currency?
Methods inherited from Stay::ApplicationController
#after_sign_in_path_for, #current_store
Methods included from LocaleHelper
#all_locales_options, #available_locales, #available_locales_options, #config_locale?, #current_locale, #find_with_fallback_default_locale, #locale_full_name, #locale_param, #locale_presentation, #params_locale?, #should_render_locale_dropdown?, #supported_locale?, #supported_locales, #supported_locales_for_all_stores, #supported_locales_options, #user_locale?
Methods included from CurrencyHelper
#currency_options, #currency_presentation, #currency_symbol, #should_render_currency_dropdown?, #supported_currency_options
Instance Method Details
#create ⇒ Object
POST /admin/countries/:country_id/states
24 25 26 27 28 29 30 31 |
# File 'app/controllers/stay/admin/states_controller.rb', line 24 def create @state = @country.states.build(state_params) if @state.save redirect_to admin_country_states_path(@country), notice: 'State was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /admin/countries/:country_id/states/:id
47 48 49 50 |
# File 'app/controllers/stay/admin/states_controller.rb', line 47 def destroy @state.destroy redirect_to admin_country_states_path(@country), notice: 'State was successfully deleted.' end |
#edit ⇒ Object
GET /admin/countries/:country_id/states/:id/edit
34 35 |
# File 'app/controllers/stay/admin/states_controller.rb', line 34 def edit end |
#index ⇒ Object
GET /admin/countries/:country_id/states
6 7 8 9 10 11 12 |
# File 'app/controllers/stay/admin/states_controller.rb', line 6 def index @states = @country.states.page(params[:page]) respond_to do |format| format.html format.json { render json: @states } end end |
#new ⇒ Object
GET /admin/countries/:country_id/states/new
19 20 21 |
# File 'app/controllers/stay/admin/states_controller.rb', line 19 def new @state = @country.states.build end |
#show ⇒ Object
GET /admin/countries/:country_id/states/:id
15 16 |
# File 'app/controllers/stay/admin/states_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /admin/countries/:country_id/states/:id
38 39 40 41 42 43 44 |
# File 'app/controllers/stay/admin/states_controller.rb', line 38 def update if @state.update(state_params) redirect_to admin_country_states_path(@country), notice: 'State was successfully updated.' else render :edit end end |