Class: Spreadhead::PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Spreadhead::PagesController
- Defined in:
- app/controllers/spreadhead/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
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 22 def create @page = ::Page.new(params[:page]) respond_to do |format| if @page.save format.html { redirect_to pages_url } format.xml { head :created, :location => pages_url } else format.html { render :action => "new" } format.xml { render :xml => @page.errors.to_xml } end end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 48 def destroy @page = ::Page.find(params[:id]) @page.destroy respond_to do |format| format.html { redirect_to pages_url } format.xml { head :ok } end end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 18 def edit @page = ::Page.find(params[:id]) end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 10 def index @pages = ::Page.find(:all) end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 6 def new @page = ::Page.new end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 14 def show @page = ::Page.published.find_by_url!(params[:url].to_a.join('/')) end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/spreadhead/pages_controller.rb', line 35 def update @page = ::Page.find(params[:id]) respond_to do |format| if @page.update_attributes(params[:page]) format.html { redirect_to pages_url } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @page.errors.to_xml } end end end |