changeset 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 bb5f98459aac
children 8f0fb869e770
files app/controllers/pastes_controller.rb
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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|