Mercurial > zeropaste
diff app/controllers/pastes_controller.rb @ 183:fc234f8cf3d9
Return on duplicate based on post format.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Tue, 12 Feb 2013 11:32:14 +0900 |
parents | 500c09718fd7 |
children | b4b7a29b70f6 |
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb Tue Feb 12 11:31:40 2013 +0900 +++ b/app/controllers/pastes_controller.rb Tue Feb 12 11:32:14 2013 +0900 @@ -62,7 +62,12 @@ format.txt end rescue ActiveRecord::RecordNotUnique - redirect_to paste_path(Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first) + @paste = Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first + respond_to do |format| + format.html { redirect_to paste_path(@paste) } + format.json { render :json => @paste } + format.txt + end end end