We've moved discussions to Discord

possible Pay or Administrate gem error : 'polymorphic_path' issue with upgrade to Rails 6.0.3.7

John Quarto-vonTivadar
After I upgraded Rails to 6.0.3.7, I noticed an error in JSP Admin/Pay/Subscriptions
of `Please use symbols for polymorphic route arguments.`

This is due to a security fix dated a few days ago (early May 2021)
https://github.com/rails/rails/issues/42157

it was somewhat straightforward to fix the `polymorphic_path` instances ( I found 2 in JSP)
However it also affects `links_to`, such as
app/views/admin/pay/subscriptions/index.html, line 44

the issue thread linked above mentions that a lot of errors come from gems wherein it shows up as a link_to error in one's code  but under the hood the gem is also using polymorphic_path . (I'm guessing here it's the Pay gem).

They also mention that folks won't run into the problem until runtime since there's not a lot of Rails test coverage on this particular subtlety. Which is what I experienced, it was only when I went into the Pay Subscriptions portion of the JSP Admin that I hit the bug and became aware.

I don't have the skillset to fix this otherwise I'd do a PR

John Quarto-vonTivadar
Or maybe it's the Administrate gem , since they already posted a fix:
https://github.com/thoughtbot/administrate/pull/1972

I did a `bundle update` to pull in v0.16.0 of Chris' administrate fork that comes with JSP, hoping that would pull in the fix for the gem. But I get the same error
John Chambers
Seems to be an administrate issue alright.

I ran into this a few days ago and set my rails gem to the following for now to resolve

gem "rails", "6.1.3.1"



John Quarto-vonTivadar
John, do you suppose this is an issue that will self-resolve when other gems get updated? It looks like Chris' administrate was updated in part due to this security update. Yet the issue remained even after I updated that gem.
William Kennedy
I ran into this issue a while ago and I submitted a PR to Chris's fork which is what jumpstart uses.

Is this happening on a fresh install or an old one?

https://github.com/excid3/administrate/pull/4
Chris Oliver
The fix is to cast to a symbol in app/views/admin/pay/subscriptions/index.html.erb since we've overridden that view.

-      [:new, namespace, page.resource_path],
+      [:new, namespace, page.resource_path.to_sym],

Latest JSP has been updated to include this. 👍
Ugurcan Kaya
@ Chris Oliver this does not fix it for me. Any idea what else it might be?

I get error at line 16 here https://github.com/excid3/administrate/blob/jumpstart/app/controllers/administrate/application_controller.rb
Ugurcan Kaya
never mind. it works after removing and reinstalling the gem from your branch again. 

Not sure what happened but I am pretty sure I fetched all changes before.
Notifications
You’re not receiving notifications from this thread.