diff app/controllers/pastes_controller.rb @ 212:186b4674bcbe

Add controller support for is_private flag
author Edho Arief <edho@myconan.net>
date Sun, 12 May 2013 02:41:35 +0900
parents 5e1d728975a4
children 9998d8b6c524
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb	Sun May 12 02:41:08 2013 +0900
+++ b/app/controllers/pastes_controller.rb	Sun May 12 02:41:35 2013 +0900
@@ -4,7 +4,7 @@
   # GET /1
   # GET /1.txt
   def show
-    @paste = Paste.find(params[:id])
+    @paste = Paste.safe_find(params[:id])
 
     expires_in 1.year, :public => true
     respond_to do |format|
@@ -62,7 +62,7 @@
   end
 
   def destroy
-    @paste = Paste.find(params[:id])
+    @paste = Paste.safe_find(params[:id])
     if @paste.key == params[:paste][:key]
       @paste.destroy
       expire_page :controller => 'pastes', :action => 'show', :id => @paste.id
@@ -76,6 +76,6 @@
 
   private
   def paste_params
-    params.require(:paste).permit(:paste, :key)
+    params.require(:paste).permit(:paste, :is_private, :key)
   end
 end