Class: Admin::PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PagesController
- Defined in:
- lib/generators/pages/templates/admin_pages_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 20 def create @page = Page.new(params[:page]) if @page.save redirect_to(pages_path, :notice => 'Page was successfully created.') else render :action => "new" end end |
#destroy ⇒ Object
40 41 42 43 44 45 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 40 def destroy @page = Page.find(params[:id]) @page.destroy redirect_to(pages_path, :notice => 'Page was successfully removed.') end |
#edit ⇒ Object
16 17 18 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 16 def edit @page = Page.find(params[:id]) end |
#index ⇒ Object
4 5 6 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 4 def index @pages = Page.order('updated_at desc') end |
#new ⇒ Object
12 13 14 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 12 def new @page = Page.new end |
#show ⇒ Object
8 9 10 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 8 def show @page = Page.find(params[:id]) end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/generators/pages/templates/admin_pages_controller.rb', line 30 def update @page = Page.find(params[:id]) if @page.update_attributes(params[:page]) redirect_to(pages_path, :notice => 'Page was successfully updated.') else render :action => "edit" end end |