routing-filter icon indicating copy to clipboard operation
routing-filter copied to clipboard

routing-filter doesn't seem to work with rails 7.1

Open edouard opened this issue 2 years ago • 4 comments
trafficstars

It worked fine with rails 7.0 but not with 7.1. When using filter :locale in routes.rb, params[:locale] isn't set to anything

edouard avatar Oct 26 '23 08:10 edouard

For the record - Here is the PR that broke compatibility: https://github.com/rails/rails/pull/49340

dbackeus avatar Jan 29 '24 09:01 dbackeus

I think https://github.com/svenfuchs/routing-filter/pull/86 would fix this.

fwolfst avatar Feb 22 '24 08:02 fwolfst

That PR does not fix the issue in our app. It appears to be a different error in that it avoids some exception. It does not fix the "silent failure" for mutating params.

dbackeus avatar Feb 22 '24 10:02 dbackeus

Temporary fix is to use params: { locale: "en" } in button_to helper, see https://edgeapi.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-button_to.

I discovered this problem in a new app, but after fixing this, I still can not redirect to correct root path, because after redirect_back_or_to root_path(locale), I still have the old URL in my browser. Seams to be related to how Turbo 8 is now loading/reloading the pages. Anyway, need to figure out, what is wrong in my setup, as the approach described in https://edgeguides.rubyonrails.org/i18n.html#managing-the-locale-across-requests is not working for me (and probably for all new apps?).

viktorianer avatar Feb 23 '24 15:02 viktorianer