Class: PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PagesController
- Defined in:
- app/controllers/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/pages_controller.rb', line 17 def create @page = Page.new page_params if @page.save #TODO: set flash message? redirect_to edit_page_url(@page.id) else render 'new' end end |
#destroy ⇒ Object
37 38 39 40 |
# File 'app/controllers/pages_controller.rb', line 37 def destroy @page.destroy redirect_to admin_pages_url end |
#edit ⇒ Object
13 14 15 |
# File 'app/controllers/pages_controller.rb', line 13 def edit @page = Page.find params[:id] end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/pages_controller.rb', line 5 def index @pages = Page.ordered end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/pages_controller.rb', line 9 def new @page = Page.new end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/pages_controller.rb', line 27 def update @page = Page.find params[:id] if @page.update(page_params) #TODO: set flash message? redirect_to edit_page_url(@page.id) else render 'edit' end end |