diff app/controllers/pastes_controller.rb @ 69:be561c3967ee

Safety net to ignore invalid post requests.
author Edho Arief <edho@myconan.net>
date Thu, 04 Oct 2012 10:31:15 +0700
parents f7b7a39fb48c
children f480cdf5f3df
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb	Thu Oct 04 10:27:32 2012 +0700
+++ b/app/controllers/pastes_controller.rb	Thu Oct 04 10:31:15 2012 +0700
@@ -35,8 +35,10 @@
   # POST /pastes.json
   def create
     @paste = Paste.new
-    @paste.paste = params[:paste][:paste]
-    @paste.ip = request.remote_ip
+    if params[:paste] and not params[:paste][:paste].blank?
+      @paste.paste = params[:paste][:paste]
+      @paste.ip = request.remote_ip
+    end
 
     begin
       respond_to do |format|