David Thomas
2808a41f0d
Safely autocorrect Rails/RedirectBackOrTo
...
Inspecting 1721 files
........................................W...................................................................W................W..W.......W................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/controllers/admin/order_cycles_controller.rb:212:9: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
redirect_back(fallback_location: root_path)
^^^^^^^^^^^^^
app/controllers/locales_controller.rb:6:5: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
redirect_back fallback_location: main_app.root_url
^^^^^^^^^^^^^
app/controllers/spree/admin/invoices_controller.rb:31:9: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
redirect_back(fallback_location: spree.admin_dashboard_path)
^^^^^^^^^^^^^
app/controllers/spree/admin/orders_controller.rb:83:9: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
redirect_back fallback_location: spree.admin_dashboard_path
^^^^^^^^^^^^^
app/controllers/spree/admin/orders_controller.rb:91:25: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
format.html { redirect_back(fallback_location: spree.admin_dashboard_path) }
^^^^^^^^^^^^^
app/controllers/spree/admin/return_authorizations_controller.rb:13:9: W: [Corrected] Rails/RedirectBackOrTo: Use redirect_back_or_to instead of redirect_back with :fallback_location keyword argument.
redirect_back fallback_location: spree.admin_dashboard_path
^^^^^^^^^^^^^
1721 files inspected, 6 offenses detected, 6 offenses corrected
2026-02-26 15:35:55 -05:00
Jean-Baptiste Bellet
aa982fe8df
Create a new method to change the lang of the app
...
- The old method (link to `?locale=#{l.to_s}`) was not functional for path that already has query params in current path (such as `/user/spree_user/password/edit?reset_password_token=`) ;
- This seems that the best way to handle this, is to create a new route, new method that effectively set the lang (not the locale actually...) and then redirect_back (ie. using the HTTP_REFERER, with a fallback to `/`)
s
2021-07-06 10:09:37 +02:00