Passing locale as a symbol should work.
jamesst20 opened this issue · 3 comments
Rails : 5.0.7.1
route_translator: 7.1.2
ruby : 2.4.9
Upgrading from Rails 4 to Rails 5 have broken all my tests using localized paths.
Behavior
# Works on Rails 4, fails on Rails 5
post :login_password, params: { locale: I18n.locale, client: { email: client.email } }
Exception
Minitest::UnexpectedError: ActionController::UrlGenerationError: No route matches {:action=>"login_password", :client=>{:email=>"cliff.johnson@spencer.biz"}, :controller=>"sites", :locale=>:"en-ca"}
Temporary Fix (adding .to_s)
post :login_password, params: { locale: I18n.locale.to_s, client: { email: client.email } }
Hi!
Thanks for being part of the route_translator community.
Passing locale as a symbol should work
Yes, it should, but it doesn't. :)
This is also documented in our wiki here: https://github.com/enriclluelles/route_translator/wiki/Generating-translated-URLs
The following considerations still apply #192 (comment)
Closing here as a duplicate of #192
Thank you for the quick response, I will take a look.
A quick fix would not to be simply always calling "to_s" internally so the symbol gets converted to a string?
A quick fix would not to be simply always calling "to_s" internally so the symbol gets converted to a string?
No, sorry, this is not that simple. I've tried without success.
I will add a note here too: https://github.com/enriclluelles/route_translator#testing The test example uses a string, but it does not specify that it is intended