Skip to content

Commit

Permalink
Fixed routing snafu
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1736 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Jul 6, 2005
1 parent dc8989a commit 212cc38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_controller/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ def url_helper_name(name)

def name_route(route, name)
hash = route.known.symbolize_keys
hash[:controller] = "/#{hash[:controller]}"

define_method(hash_access_name(name)) { hash }
module_eval(%{def #{url_helper_name name}(options = {})
Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/controller/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@ def test_route_generating_string_literal_in_comparison_warning
def test_basic_named_route
rs.home '', :controller => 'content', :action => 'list'
x = setup_for_named_route
assert_equal({:controller => 'content', :action => 'list'},
assert_equal({:controller => '/content', :action => 'list'},
x.new.send(:home_url))
end

def test_named_route_with_option
rs.page 'page/:title', :controller => 'content', :action => 'show_page'
x = setup_for_named_route
assert_equal({:controller => 'content', :action => 'show_page', :title => 'new stuff'},
assert_equal({:controller => '/content', :action => 'show_page', :title => 'new stuff'},
x.new.send(:page_url, :title => 'new stuff'))
end

Expand Down

0 comments on commit 212cc38

Please sign in to comment.