<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -116,7 +116,7 @@ module ActionController #:nodoc:
     end
     
     def apply_redirect_to(redirect_to_option) # :nodoc:
-      redirect_to_option.is_a?(Symbol) ? self.send!(redirect_to_option) : redirect_to_option
+      (redirect_to_option.is_a?(Symbol) &amp;&amp; redirect_to_option != :back) ? self.send!(redirect_to_option) : redirect_to_option
     end
     
     def apply_remaining_actions(options) # :nodoc:</diff>
      <filename>actionpack/lib/action_controller/verification.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,10 +21,10 @@ class VerificationTest &lt; Test::Unit::TestCase
 
     verify :only =&gt; :guarded_by_method, :method =&gt; :post,
            :redirect_to =&gt; { :action =&gt; &quot;unguarded&quot; }
-           
+
     verify :only =&gt; :guarded_by_xhr, :xhr =&gt; true,
            :redirect_to =&gt; { :action =&gt; &quot;unguarded&quot; }
-           
+
     verify :only =&gt; :guarded_by_not_xhr, :xhr =&gt; false,
            :redirect_to =&gt; { :action =&gt; &quot;unguarded&quot; }
 
@@ -39,10 +39,13 @@ class VerificationTest &lt; Test::Unit::TestCase
 
     verify :only =&gt; :no_default_action, :params =&gt; &quot;santa&quot;
 
+    verify :only =&gt; :guarded_with_back, :method =&gt; :post,
+           :redirect_to =&gt; :back
+
     def guarded_one
       render :text =&gt; &quot;#{params[:one]}&quot;
     end
-    
+
     def guarded_one_for_named_route_test
       render :text =&gt; &quot;#{params[:one]}&quot;
     end
@@ -70,11 +73,11 @@ class VerificationTest &lt; Test::Unit::TestCase
     def guarded_by_method
       render :text =&gt; &quot;#{request.method}&quot;
     end
-    
+
     def guarded_by_xhr
       render :text =&gt; &quot;#{request.xhr?}&quot;
     end
-    
+
     def guarded_by_not_xhr
       render :text =&gt; &quot;#{request.xhr?}&quot;
     end
@@ -86,15 +89,19 @@ class VerificationTest &lt; Test::Unit::TestCase
     def two_redirects
       render :nothing =&gt; true
     end
-    
+
     def must_be_post
       render :text =&gt; &quot;Was a post!&quot;
     end
-    
+
+    def guarded_with_back
+      render :text =&gt; &quot;#{params[:one]}&quot;
+    end
+
     def no_default_action
       # Will never run
     end
-    
+
     protected
       def rescue_action(e) raise end
 
@@ -109,7 +116,17 @@ class VerificationTest &lt; Test::Unit::TestCase
     @response   = ActionController::TestResponse.new
     ActionController::Routing::Routes.add_named_route :foo, '/foo', :controller =&gt; 'test', :action =&gt; 'foo'
   end
-  
+
+  def test_using_symbol_back_with_no_referrer
+    assert_raise(ActionController::RedirectBackError) { get :guarded_with_back }
+  end
+
+  def test_using_symbol_back_redirects_to_referrer
+    @request.env[&quot;HTTP_REFERER&quot;] = &quot;/foo&quot;
+    get :guarded_with_back
+    assert_redirected_to '/foo'
+  end
+
   def test_no_deprecation_warning_for_named_route
     assert_not_deprecated do
       get :guarded_one_for_named_route_test, :two =&gt; &quot;not one&quot;
@@ -209,44 +226,44 @@ class VerificationTest &lt; Test::Unit::TestCase
     get :guarded_by_method
     assert_redirected_to :action =&gt; &quot;unguarded&quot;
   end
-  
+
   def test_guarded_by_xhr_with_prereqs
     xhr :post, :guarded_by_xhr
     assert_equal &quot;true&quot;, @response.body
   end
-    
+
   def test_guarded_by_xhr_without_prereqs
     get :guarded_by_xhr
     assert_redirected_to :action =&gt; &quot;unguarded&quot;
   end
-  
+
   def test_guarded_by_not_xhr_with_prereqs
     get :guarded_by_not_xhr
     assert_equal &quot;false&quot;, @response.body
   end
-    
+
   def test_guarded_by_not_xhr_without_prereqs
     xhr :post, :guarded_by_not_xhr
     assert_redirected_to :action =&gt; &quot;unguarded&quot;
   end
-  
+
   def test_guarded_post_and_calls_render_succeeds
     post :must_be_post
     assert_equal &quot;Was a post!&quot;, @response.body
   end
-    
+
   def test_default_failure_should_be_a_bad_request
     post :no_default_action
     assert_response :bad_request
   end
-    
+
   def test_guarded_post_and_calls_render_fails_and_sets_allow_header
     get :must_be_post
     assert_response 405
     assert_equal &quot;Must be post&quot;, @response.body
     assert_equal &quot;POST&quot;, @response.headers[&quot;Allow&quot;]
   end
-  
+
   def test_second_redirect
     assert_nothing_raised { get :two_redirects }
   end</diff>
      <filename>actionpack/test/controller/verification_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4d83e9d737a703b3634d0163599bdbede0500c31</id>
    </parent>
  </parents>
  <author>
    <name>Amos King</name>
    <email>amos.l.king@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/b99c1c939cd2329dad6d16a9dfeafdecdd5a412d</url>
  <id>b99c1c939cd2329dad6d16a9dfeafdecdd5a412d</id>
  <committed-date>2008-06-17T10:31:27-07:00</committed-date>
  <authored-date>2008-05-29T16:49:44-07:00</authored-date>
  <message>verify :redirect_to =&gt; :back should redirect to the referrer. [#280 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>6c1e2ddafd5fbbdbb478240387b87d03330e4201</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
