diff options
author | kennyj <kennyj@gmail.com> | 2012-06-06 00:59:01 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-06-16 00:22:16 +0900 |
commit | c42a7a0082a16b47b6bb6d1b919a4b5ec6e7860d (patch) | |
tree | 2daff0c583cedf45ef5d8dc7da23ac8582147c63 /actionpack/lib | |
parent | c1b1956a15d3d38d0a4504e168bb69638d71e536 (diff) | |
download | rails-c42a7a0082a16b47b6bb6d1b919a4b5ec6e7860d.tar.gz rails-c42a7a0082a16b47b6bb6d1b919a4b5ec6e7860d.tar.bz2 rails-c42a7a0082a16b47b6bb6d1b919a4b5ec6e7860d.zip |
Support unicode character route in config/routes.rb.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 38a0270151..29090882a5 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 require 'active_support/core_ext/object/to_param' require 'active_support/core_ext/regexp' @@ -218,6 +219,12 @@ module ActionDispatch # # match "/stories" => redirect("/posts") # + # == Unicode character routes + # + # You can specify unicode character routes in your router: + # + # match "こんにちは" => "welcome#index" + # # == Routing to Rack Applications # # Instead of a String, like <tt>posts#index</tt>, which corresponds to the diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 25d099d83e..94242ad962 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1387,7 +1387,7 @@ module ActionDispatch options[:as] = name_for_action(options[:as], action) end - mapping = Mapping.new(@set, @scope, path, options) + mapping = Mapping.new(@set, @scope, URI.parser.escape(path), options) app, conditions, requirements, defaults, as, anchor = mapping.to_route @set.add_route(app, conditions, requirements, defaults, as, anchor) end |