Class: EngineRoom::SectionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- EngineRoom::SectionsController
- Defined in:
- app/controllers/engine_room/sections_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /section.
-
#destroy ⇒ Object
DELETE /section/1.
-
#edit ⇒ Object
GET /section/1/edit.
-
#index ⇒ Object
GET /section_configs.
- #init_sections ⇒ Object
-
#new ⇒ Object
GET /section_config/new.
-
#show ⇒ Object
GET /section_config/1.
-
#update ⇒ Object
PUT /section/1.
Instance Method Details
#create ⇒ Object
POST /section
41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/engine_room/sections_controller.rb', line 41 def create @section = Section.new(params[:section]) if @section.save flash[:notice] = 'Section was successfully created.' redirect_to :action => :index else add_crumb('Create New Section', new_engine_room_section_path) render :action => :new end end |
#destroy ⇒ Object
DELETE /section/1
65 66 67 68 69 70 71 |
# File 'app/controllers/engine_room/sections_controller.rb', line 65 def destroy @section = Section.find(params[:id]) @section.destroy flash[:notice] = 'Section was successfully deleted.' redirect_to :action => :index end |
#edit ⇒ Object
GET /section/1/edit
35 36 37 38 |
# File 'app/controllers/engine_room/sections_controller.rb', line 35 def edit @section = Section.find(params[:id]) add_crumb(@section.name.titleize, edit_engine_room_section_path(params[:id])) end |
#index ⇒ Object
GET /section_configs
17 18 19 20 |
# File 'app/controllers/engine_room/sections_controller.rb', line 17 def index @sections = Section.order('sort_order ASC') # index.html.erb end |
#init_sections ⇒ Object
11 12 13 14 |
# File 'app/controllers/engine_room/sections_controller.rb', line 11 def init_sections @sections = Section.order('sort_order ASC') @layout = 'columns' end |
#new ⇒ Object
GET /section_config/new
29 30 31 32 |
# File 'app/controllers/engine_room/sections_controller.rb', line 29 def new @section = Section.new add_crumb 'Create New Section' end |
#show ⇒ Object
GET /section_config/1
23 24 25 26 |
# File 'app/controllers/engine_room/sections_controller.rb', line 23 def show @section = Section.find(params[:id]) # show.html.erb end |
#update ⇒ Object
PUT /section/1
53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/engine_room/sections_controller.rb', line 53 def update @section = Section.find(params[:id]) if @section.update_attributes(params[:section]) flash[:notice] = 'Section was successfully updated.' redirect_to :action => :index else add_crumb(@section.name.titleize, edit_engine_room_section_path(params[:id])) render :action => :edit end end |