diff options
author | wycats <wycats@gmail.com> | 2010-03-16 17:28:44 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-16 17:29:11 -0700 |
commit | 7c49b1adbbe1ffd42c8cd6fc0439d53895c861cf (patch) | |
tree | 4afdcda1d8215e835251c7a980971e1d71390155 | |
parent | 0c1ac36ccb7d72f3d17d950d030442a7e83d0708 (diff) | |
download | rails-7c49b1adbbe1ffd42c8cd6fc0439d53895c861cf.tar.gz rails-7c49b1adbbe1ffd42c8cd6fc0439d53895c861cf.tar.bz2 rails-7c49b1adbbe1ffd42c8cd6fc0439d53895c861cf.zip |
Make sure options[:anchor] is correct in shorthand cases
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index f9b27a5a03..668abb5fdf 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -51,7 +51,9 @@ module ActionDispatch options.merge!(:to => to).delete(path) if path when using_match_shorthand?(args, options) path = args.first - options = { :to => path.gsub("/", "#"), :as => path.gsub("/", "_") } + options = { :to => path.gsub("/", "#"), + :as => path.gsub("/", "_") + }.merge(options || {}) else path = args.first end @@ -301,7 +303,6 @@ module ActionDispatch options = args.extract_options! options = (@scope[:options] || {}).merge(options) - options[:anchor] = true unless options.key?(:anchor) if @scope[:name_prefix] && !options[:as].blank? options[:as] = "#{@scope[:name_prefix]}_#{options[:as]}" @@ -563,6 +564,8 @@ module ActionDispatch def match(*args) options = args.extract_options! + options[:anchor] = true unless options.key?(:anchor) + if args.length > 1 args.each { |path| match(path, options) } return self |