Mercurial > zeropaste
comparison 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 |
comparison
equal
deleted
inserted
replaced
68:bb5f98459aac | 69:be561c3967ee |
---|---|
33 | 33 |
34 # POST /pastes | 34 # POST /pastes |
35 # POST /pastes.json | 35 # POST /pastes.json |
36 def create | 36 def create |
37 @paste = Paste.new | 37 @paste = Paste.new |
38 @paste.paste = params[:paste][:paste] | 38 if params[:paste] and not params[:paste][:paste].blank? |
39 @paste.ip = request.remote_ip | 39 @paste.paste = params[:paste][:paste] |
40 @paste.ip = request.remote_ip | |
41 end | |
40 | 42 |
41 begin | 43 begin |
42 respond_to do |format| | 44 respond_to do |format| |
43 if @paste.save | 45 if @paste.save |
44 format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } | 46 format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } |