routing-filter doesn't seem to work with rails 7.1
edouard opened this issue · 4 comments
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
For the record - Here is the PR that broke compatibility: rails/rails#49340
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.
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?).