Use namespace as symbol in polymorphic_path calls

Our `namespace` helper returns a string. However, Rails version 5.2.4.6
doesn't allow strings as arguments to polymorphic_path [1]

Since returning a symbol in our `namespace` helper would break other
places in the application, we're converting it to a symbol in the
methods calling `polymorphic_path`.

[1] https://github.com/advisories/GHSA-hjg4-8q5f-x6fm
This commit is contained in:
Javi Martín
2021-05-20 18:14:26 +02:00
parent 5f4dd48e25
commit 85f13f9501
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
<%= render "shared/globalize_locales", resource: card %>
<%= translatable_form_for [namespace, card.cardable, card], url: local_assigns[:url] do |f| %>
<%= translatable_form_for [namespace.to_sym, card.cardable, card], url: local_assigns[:url] do |f| %>
<%= render "shared/errors", resource: card %>
<div class="row">

View File

@@ -30,9 +30,9 @@ module ActionDispatch::Routing::UrlFor
resolve = resolve_for(resource)
resolve_options = resolve.pop
polymorphic_path([namespace, *resolve], options.merge(resolve_options))
polymorphic_path([namespace.to_sym, *resolve], options.merge(resolve_options))
else
polymorphic_path([namespace, *resource_hierarchy_for(resource)], options)
polymorphic_path([namespace.to_sym, *resource_hierarchy_for(resource)], options)
end
end