changeset 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 e0817b84c01b
children bb5f98459aac
files app/controllers/pastes_controller.rb app/views/pastes/create.txt.erb
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- /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 %>