Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Document change to clashing named route selection from journey commit…

… 98a9802a
  • Loading branch information...
commit d717882eb501510b8367382ea7d6c0097aac38cf 1 parent f278deb
@trevorturk trevorturk authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 guides/source/upgrading_ruby_on_rails.md
View
26 guides/source/upgrading_ruby_on_rails.md
@@ -103,6 +103,32 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur
* Rails 4.0 changed how `assert_generates`, `assert_recognizes`, and `assert_routing` work. Now all these assertions raise `Assertion` instead of `ActionController::RoutingError`.
+* Rails 4.0 correctly prefers the first named route defined in `config/routes.rb` if a clashing route is found later. Check the output of `rake routes` before upgrading and remove unused named routes to avoid issues.
+
+```ruby
+ # config/routes.rb
+ get 'one' => 'test#example', as: :example
+ get 'two' => 'test#example', as: :example
+
+ # Rails 3
+ <%= example_path %> # => '/two'
+
+ # Rails 4
+ <%= example_path %> # => '/one'
+```
+
+```ruby
+ # config/routes.rb
+ resources :examples
+ get 'clashing/:id' => 'test#example', as: :example
+
+ # Rails 3
+ <%= example_path(1) %> # => '/clashing/1'
+
+ # Rails 4
+ <%= example_path(1) %> # => '/examples/1'
+```
+
* Rails 4.0 also changed the way unicode character routes are drawn. Now you can draw unicode character routes directly. If you already draw such routes, you must change them, for example:
```ruby
Please sign in to comment.
Something went wrong with that request. Please try again.