Mercurial > zeropaste
changeset 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 | 0bda7690529c |
children | 02298b3d35cf |
files | app/controllers/pastes_controller.rb |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
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