comparison app/controllers/pastes_controller.rb @ 191:4e409ac7082d

Also expires the page upon deletion.
author Edho Arief <edho@myconan.net>
date Sat, 23 Feb 2013 14:53:47 +0900
parents d4682cea8e58
children 5e1d728975a4
comparison
equal deleted inserted replaced
190:d4682cea8e58 191:4e409ac7082d
77 77
78 def destroy 78 def destroy
79 @paste = Paste.find(params[:id].to_i) 79 @paste = Paste.find(params[:id].to_i)
80 if @paste.key == params[:paste][:key] 80 if @paste.key == params[:paste][:key]
81 @paste.destroy 81 @paste.destroy
82 expire_page :controller => 'pastes', :action => 'show', :id => @paste.id
82 flash[:notice] = "Paste ##{params[:id]} deleted" 83 flash[:notice] = "Paste ##{params[:id]} deleted"
83 redirect_to root_path 84 redirect_to root_path
84 else 85 else
85 flash[:error] = 'Incorrect deletion key' 86 flash[:error] = 'Incorrect deletion key'
86 render :action => :show 87 render :action => :show