mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make Routes drop the default for action when the controller changes #651
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@640 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c00bf5f0c6
commit
29066036f2
2 changed files with 8 additions and 2 deletions
|
@ -224,6 +224,7 @@ module ActionController
|
|||
else
|
||||
relative_to = defaults[:controller] ? defaults[:controller].split('/')[0..-2].join('/') : ''
|
||||
options[:controller] = relative_to.empty? ? options[:controller] : "#{relative_to}/#{options[:controller]}"
|
||||
defaults.delete(:action) unless options[:controller] == defaults[:controller]
|
||||
end
|
||||
else
|
||||
options[:controller] = defaults[:controller]
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# ActionController::Routing::RailsRoute: 0 / 4 = 0.00%
|
||||
# ActionController::Routing::Route: 0 / 8 = 0.00%
|
||||
|
||||
RAILS_ROOT = ""
|
||||
require File.dirname(__FILE__) + '/../abstract_unit'
|
||||
require 'test/unit'
|
||||
require 'cgi'
|
||||
|
@ -394,10 +393,16 @@ class RouteSetTests < Test::Unit::TestCase
|
|||
assert_raises(ActionController::RoutingError) {@set.generate({}, @request)}
|
||||
end
|
||||
|
||||
|
||||
def test_encoded_strings
|
||||
verify_recognize(Controllers::Admin::UserController, {:controller => 'admin/user', :action => 'info', :id => "Nicholas Seckar"}, path='/admin/user/info/Nicholas%20Seckar')
|
||||
end
|
||||
|
||||
def test_action_dropped_when_controller_changes
|
||||
@request.path_parameters = {:controller => 'content', :action => 'list'}
|
||||
options = {:controller => 'resource'}
|
||||
@set.connect ':action/:controller'
|
||||
verify_generate('index/resource', options)
|
||||
end
|
||||
end
|
||||
|
||||
#require '../assertions/action_pack_assertions.rb'
|
||||
|
|
Loading…
Reference in a new issue