diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-11-30 10:28:16 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-11-30 10:28:16 +0000 |
commit | 079ac4a0584b24625266a0e9448503d1b96c2b7f (patch) | |
tree | 6a28edeb393cd095de252335f9e3c9cec7c78d13 /actionview/lib/action_view/routing_url_for.rb | |
parent | bd9ffa7e1fb433f359ee096a2afd924a652d1912 (diff) | |
parent | 6874133f9e5ca79f30f43632da4338d7b82ddeff (diff) | |
download | rails-079ac4a0584b24625266a0e9448503d1b96c2b7f.tar.gz rails-079ac4a0584b24625266a0e9448503d1b96c2b7f.tar.bz2 rails-079ac4a0584b24625266a0e9448503d1b96c2b7f.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionview/lib/action_view/routing_url_for.rb')
-rw-r--r-- | actionview/lib/action_view/routing_url_for.rb | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index 75febb8652..f281333a41 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -80,21 +80,38 @@ module ActionView when String options when nil - super({:only_path => true}) + super(only_path: _generate_paths_by_default) when Hash options = options.symbolize_keys - options[:only_path] = options[:host].nil? unless options.key?(:only_path) + unless options.key?(:only_path) + if options[:host].nil? + options[:only_path] = _generate_paths_by_default + else + options[:only_path] = false + end + end + super(options) when :back _back_url - when Symbol - ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_string_call self, options when Array - polymorphic_path(options, options.extract_options!) - when Class - ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_class_call self, options + if _generate_paths_by_default + polymorphic_path(options, options.extract_options!) + else + polymorphic_url(options, options.extract_options!) + end else - ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_model_call self, options + method = _generate_paths_by_default ? :path : :url + builder = ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.send(method) + + case options + when Symbol + builder.handle_string_call(self, options) + when Class + builder.handle_class_call(self, options) + else + builder.handle_model_call(self, options) + end end end |