Class: Geography::StatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Geography::StatesController
- Defined in:
- app/controllers/geography/states_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /states.
-
#destroy ⇒ Object
DELETE /states/1.
-
#edit ⇒ Object
GET /states/1/edit.
-
#index ⇒ Object
GET /states.
-
#new ⇒ Object
GET /states/new.
-
#show ⇒ Object
GET /states/1.
-
#update ⇒ Object
PATCH/PUT /states/1.
Instance Method Details
#create ⇒ Object
POST /states
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/geography/states_controller.rb', line 26 def create :create, @state @state = State.new(state_params) if @state.save redirect_to @state, notice: 'State was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /states/1
47 48 49 50 |
# File 'app/controllers/geography/states_controller.rb', line 47 def destroy @state.destroy redirect_to states_url, notice: 'State was successfully destroyed.' end |
#edit ⇒ Object
GET /states/1/edit
22 23 |
# File 'app/controllers/geography/states_controller.rb', line 22 def edit end |
#index ⇒ Object
GET /states
8 9 10 |
# File 'app/controllers/geography/states_controller.rb', line 8 def index @states = State.all.order(:name) end |
#new ⇒ Object
GET /states/new
17 18 19 |
# File 'app/controllers/geography/states_controller.rb', line 17 def new @state = State.new end |
#show ⇒ Object
GET /states/1
13 14 |
# File 'app/controllers/geography/states_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /states/1
38 39 40 41 42 43 44 |
# File 'app/controllers/geography/states_controller.rb', line 38 def update if @state.update(state_params) redirect_to @state, notice: 'State was successfully updated.' else render :edit end end |