diff options
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/tag_helper.rb | 11 | ||||
-rw-r--r-- | guides/source/working_with_javascript_in_rails.md | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index a006a146ed..c968381c26 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -676,8 +676,8 @@ module ActionDispatch # Remove leading slashes from controllers def normalize_controller! if controller - if m = controller.match(/\A\/(?<controller_without_leading_slash>.*)/) - @options[:controller] = m[:controller_without_leading_slash] + if controller.start_with?("/".freeze) + @options[:controller] = controller[1..-1] else @options[:controller] = controller end diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 30af09cbac..2562504896 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -154,12 +154,17 @@ module ActionView options.each_pair do |key, value| if TAG_PREFIXES.include?(key) && value.is_a?(Hash) value.each_pair do |k, v| - output << sep + prefix_tag_option(key, k, v, escape) + output << sep + output << prefix_tag_option(key, k, v, escape) end elsif BOOLEAN_ATTRIBUTES.include?(key) - output << sep + boolean_tag_option(key) if value + if value + output << sep + output << boolean_tag_option(key) + end elsif !value.nil? - output << sep + tag_option(key, value, escape) + output << sep + output << tag_option(key, value, escape) end end output unless output.empty? diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index f3d3a83afc..4c996dd2d0 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -258,7 +258,7 @@ this generates ```html <form action="/articles/1" class="button_to" data-remote="true" method="post"> - <div><input type="submit" value="An article"></div> + <input type="submit" value="An article" /> </form> ``` |