comparison app/controllers/pastes_controller.rb @ 67:f7b7a39fb48c

Allow post in txt format pt. 2 (view and controller).
author Edho Arief <edho@myconan.net>
date Thu, 04 Oct 2012 10:20:58 +0700
parents 817c54a72b58
children be561c3967ee
comparison
equal deleted inserted replaced
66:e0817b84c01b 67:f7b7a39fb48c
45 format.json { render :json => @paste, :status => :created, :location => @paste } 45 format.json { render :json => @paste, :status => :created, :location => @paste }
46 else 46 else
47 format.html { render :action => "new" } 47 format.html { render :action => "new" }
48 format.json { render :json => @paste.errors, :status => :unprocessable_entity } 48 format.json { render :json => @paste.errors, :status => :unprocessable_entity }
49 end 49 end
50 format.txt
50 end 51 end
51 rescue ActiveRecord::RecordNotUnique 52 rescue ActiveRecord::RecordNotUnique
52 redirect_to paste_path(Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first) 53 redirect_to paste_path(Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first)
53 end 54 end
54 end 55 end