comparison 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
comparison
equal deleted inserted replaced
182:0bda7690529c 183:fc234f8cf3d9
60 format.json { render :json => @paste.errors, :status => :unprocessable_entity } 60 format.json { render :json => @paste.errors, :status => :unprocessable_entity }
61 end 61 end
62 format.txt 62 format.txt
63 end 63 end
64 rescue ActiveRecord::RecordNotUnique 64 rescue ActiveRecord::RecordNotUnique
65 redirect_to paste_path(Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first) 65 @paste = Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first
66 respond_to do |format|
67 format.html { redirect_to paste_path(@paste) }
68 format.json { render :json => @paste }
69 format.txt
70 end
66 end 71 end
67 end 72 end
68 73
69 end 74 end