-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default_url_options in SessionsController.create #209
default_url_options in SessionsController.create #209
Conversation
I'm not sure where |
This is recommended in the rails i18n guide . It says The same mechanism already works in the Mailer thanks to the recent PR #188: , that added I'll try to write a test for this, that PR and the rails test I found are probably a good place to start, I'll see if I have time this week-end. By the way I'm impressed your reactivity. I've read in several places it's hard to be a maintainer because people only seek you when there's a problem. So in my name and in the name of your many users who never ran into a problem: thank you, you're doing a great job! |
0bd3e73
to
866d446
Compare
I wrote some tests for a i18n setup that uses the locale in scoped routes. If you look at my commits in order:
The locale tests are more verbose that I would like, each one redefines a Passwordless::LocaleParentController. They are all identical, but I didn't manage to put them in one place. I'm no ruby metaprogramming wizard, any help on that is welcome. |
I managed to make things work for me with this workaround: I subclass the SessionsController and override the create method: class MyPasswordlessSessionsController < Passwordless::SessionsController
def create
# same as in superclass but with
# the additional line that adds
# ...
**defaul_url_options Then in the routes I set scope "/:locale" do
passwordless_for :users, controller: 'my_passwordless_sessions' But this feels like a really clumsy hack. I would love to have your opinion on how to do this cleanly. |
Thank you for reporting and contributing all this back. I'm away from work this week but I'll get back to you soon! |
I …
|
To clarify: I want to support locales but I don't want to bundle them as I'd have to keep them up to date for forever going forward |
Thank you for working on this! ❤️🧡💛💚💙💜 |
Thanks for merging it ! One thing I don't understand though is where you want me to put my translation ?
|
* origin/master: Update changelog Use flash.alert (mikker#215) Update changelog Add support for scoped routes (mikker#209) Add "token" on show page to locale definition (mikker#214) v1.5.0 Update changelog Include TestHelpers in ActionDispatch::IntegrationTest (mikker#211) Add url_options param to sign_in email (mikker#208) Evaluate callable redirects in context of controller (mikker#203)
This allows to define the locale as a default_url_option in the application_controller and goes some way to implement #206
The tests pass