# HG changeset patch # User Edho Arief # Date 1349320858 -25200 # Node ID f7b7a39fb48c999657f113b863f97c5c775f4eff # Parent e0817b84c01b3f34f0b6eabab1328ef25050c192 Allow post in txt format pt. 2 (view and controller). diff -r e0817b84c01b -r f7b7a39fb48c app/controllers/pastes_controller.rb --- a/app/controllers/pastes_controller.rb Thu Oct 04 10:20:19 2012 +0700 +++ b/app/controllers/pastes_controller.rb Thu Oct 04 10:20:58 2012 +0700 @@ -47,6 +47,7 @@ format.html { render :action => "new" } format.json { render :json => @paste.errors, :status => :unprocessable_entity } end + format.txt end rescue ActiveRecord::RecordNotUnique redirect_to paste_path(Paste.where(:ip => @paste.ip, :paste_hash => @paste.paste_hash).first) diff -r e0817b84c01b -r f7b7a39fb48c app/views/pastes/create.txt.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/pastes/create.txt.erb Thu Oct 04 10:20:58 2012 +0700 @@ -0,0 +1,5 @@ +<% unless @paste.errors.any? %> +<%= paste_path @paste, :only_path => false %> +<% else %> +Failed +<% end %>