aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-13 13:44:13 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-13 13:44:13 -0700
commita0920bc6ce0d02c4f6af8e81ff833fb7e4d0893b (patch)
treefe89f415c559a21e38a7ecda4df145bb0004afab /guides
parent16466e188fa4f6853a57a0587d16447fcb06dcad (diff)
parentd717882eb501510b8367382ea7d6c0097aac38cf (diff)
downloadrails-a0920bc6ce0d02c4f6af8e81ff833fb7e4d0893b.tar.gz
rails-a0920bc6ce0d02c4f6af8e81ff833fb7e4d0893b.tar.bz2
rails-a0920bc6ce0d02c4f6af8e81ff833fb7e4d0893b.zip
Merge pull request #9690 from trevorturk/upgrade-notes
Rails 4 upgrade notes about clashing named route selection changes
Diffstat (limited to 'guides')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index cb43781f52..0941bc7e58 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/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