GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of josh/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/pkondzior/rails.git
Fixed redirects when the controller and action is named the same. Still 
haven't fixed same controller, module, and action, though #201 [Josh]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@321 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Sun Jan 02 12:10:11 -0800 2005
commit  3e7a4ecc57da31c908982f933de65d33ebbfc344
tree    92e7667f726b4755e61a87d99f08b3c4053bf1fa
parent  1f6c4aca28c5514e5d1b96b6372398aba76a3776
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed redirects when the controller and action is named the same. Still haven't fixed same controller, module, and action, though #201 [Josh]
0
+
0
 * Fixed problems with running multiple functional tests in Rails under 1.8.2 by including hack for test/unit weirdness
0
 
0
 * Added thread-safety to the DRbStore #66, #389 [Ben Stiglitz]
...
91
92
93
94
 
95
96
97
...
91
92
93
 
94
95
96
97
0
@@ -91,7 +91,7 @@ module ActionController
0
             path = path.sub(%r(#{@controller}/?), @controller + "/" + action_name(options)) # " ruby-mode
0
           end
0
         else
0
- path = path.sub((action_prefix || "") + @action + (action_suffix || ""), action_name(options, action_prefix))
0
+ path = path.sub(@controller + "/" + (action_prefix || "") + @action + (action_suffix || ""), @controller + "/" + action_name(options, action_prefix))
0
         end
0
 
0
         if options[:controller_prefix] && !options[:controller]
...
51
52
53
 
 
 
 
 
 
 
 
54
55
56
...
179
180
181
 
 
 
 
 
 
 
 
 
182
183
184
...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
0
@@ -51,6 +51,14 @@ class UrlTest < Test::Unit::TestCase
0
       "http://", "www.singlefile.com", 80, "/identity/show/5", { "id" => "5" }
0
     ), "identity", "show")
0
 
0
+ @clean_url_with_same_action_and_controller_name = ActionController::UrlRewriter.new(MockRequest.new(
0
+ "http://", "www.singlefile.com", 80, "/login/login", { }
0
+ ), "login", "login")
0
+
0
+ @clean_url_with_same_action_and_controller_and_module_name = ActionController::UrlRewriter.new(MockRequest.new(
0
+ "http://", "www.singlefile.com", 80, "/login/login/login", { "module" => "login" }
0
+ ), "login", "login")
0
+
0
     @clean_url_with_id_as_char = ActionController::UrlRewriter.new(MockRequest.new(
0
       "http://", "www.singlefile.com", 80, "/teachers/show/t", { "id" => "t" }
0
     ), "teachers", "show")
0
@@ -179,6 +187,15 @@ class UrlTest < Test::Unit::TestCase
0
     assert_equal "http://www.singlefile.com/library/settings/", @library_url.rewrite(:controller => "settings", :action => "index")
0
   end
0
 
0
+ def test_same_controller_and_action_names
0
+ assert_equal "http://www.singlefile.com/login/logout", @clean_url_with_same_action_and_controller_name.rewrite(:action => "logout")
0
+ end
0
+
0
+ # FIXME
0
+ def xtest_same_module_and_controller_and_action_names
0
+ assert_equal "http://www.singlefile.com/login/login/logout", @clean_url_with_same_action_and_controller_and_module_name.rewrite(:action => "logout")
0
+ end
0
+
0
   def test_controller_and_action_with_same_name_as_controller
0
     @clean_urls.each do |url|
0
       assert_equal "http://www.singlefile.com/anything/identity", url.rewrite(:controller => "anything", :action => "identity")

Comments

    No one has commented yet.