Skip to content

Commit

Permalink
Adding the destroy method to the sidebar as a link.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Owens authored and Joshua Owens committed Mar 11, 2008
1 parent 9b150ee commit 17915a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Expand Up @@ -122,7 +122,7 @@ def search
# DELETE /pages/1
# DELETE /pages/1.xml
def destroy
@page = Page.find(params[:id]).destroy
@page = Page.find_by_permalink(params[:id]).destroy
respond_to do |format|
format.html { redirect_to(pages_url) }
format.xml { head :ok }
Expand Down
1 change: 1 addition & 0 deletions app/views/pages/show.html.erb
Expand Up @@ -11,5 +11,6 @@
<li><%= link_to 'Edit this page', edit_page_path(@page) %></li>
<li><%= link_to('View previous revision', revision_page_url(:id => @page.permalink, :version => (@page.version - 1) )) if (@page.versions.size > 1 && @page.version > 1) %></li>
<li><%= link_to 'Return to home', pages_path unless @page.permalink == "home" %></li>
<li><%= link_to "Delete this page and all revisions", page_path(@page), :method => :delete %></li>
</ul>
<% end -%>
11 changes: 9 additions & 2 deletions db/schema.rb
@@ -1,6 +1,13 @@
# This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord to incrementally modify your database, and
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 10) do

Expand Down

0 comments on commit 17915a1

Please sign in to comment.