Class: Geography::CitiesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Geography::CitiesController
- Defined in:
- app/controllers/geography/cities_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /cities.
-
#destroy ⇒ Object
DELETE /cities/1.
-
#edit ⇒ Object
GET /cities/1/edit.
-
#index ⇒ Object
add_breadcrumb ‘Cidades’, :cities_path add_breadcrumb ‘Criar nova cidade’, ”, :only => [:new, :create] add_breadcrumb ‘Editar nova cidade’, ”, :only => [:edit, :update] GET /cities.
-
#new ⇒ Object
GET /cities/new.
-
#show ⇒ Object
GET /cities/1.
-
#update ⇒ Object
PATCH/PUT /cities/1.
Instance Method Details
#create ⇒ Object
POST /cities
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/geography/cities_controller.rb', line 29 def create :create, @city @city = City.new(city_params) if @city.save redirect_to @city, notice: 'City was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /cities/1
49 50 51 52 |
# File 'app/controllers/geography/cities_controller.rb', line 49 def destroy @city.destroy redirect_to cities_url, notice: 'City was successfully destroyed.' end |
#edit ⇒ Object
GET /cities/1/edit
25 26 |
# File 'app/controllers/geography/cities_controller.rb', line 25 def edit end |
#index ⇒ Object
add_breadcrumb ‘Cidades’, :cities_path add_breadcrumb ‘Criar nova cidade’, ”, :only => [:new, :create] add_breadcrumb ‘Editar nova cidade’, ”, :only => [:edit, :update] GET /cities
10 11 12 |
# File 'app/controllers/geography/cities_controller.rb', line 10 def index @cities = City.all.order(:name).page(params[:page]) end |
#new ⇒ Object
GET /cities/new
20 21 22 |
# File 'app/controllers/geography/cities_controller.rb', line 20 def new @city = City.new end |
#show ⇒ Object
GET /cities/1
15 16 17 |
# File 'app/controllers/geography/cities_controller.rb', line 15 def show # add_breadcrumb @city.name, '' end |
#update ⇒ Object
PATCH/PUT /cities/1
40 41 42 43 44 45 46 |
# File 'app/controllers/geography/cities_controller.rb', line 40 def update if @city.update(city_params) redirect_to @city, notice: 'City was successfully updated.' else render :edit end end |