devise
devise copied to clipboard
sign_in_and_redirect does not handle ActionDispatch::Flash
This does not work:
sign_in_and_redirect user, notice: "Signed in successfully!"
But normal redirect works
redirect_to root_path, notice: "Signed in successfully"
Rails guides: https://guides.rubyonrails.org/action_controller_overview.html#the-flash
devise 4.8.1
rails 7.0.2.2
I went into the rabbit hole and found out that you pass the options to the sign_in and not the redirect. Which is reasonable, do you think that maybe we could add an option like redirect_options and pass that key there and pass it to the redirect?
Something like
sign_in_and_redirect user, redirect_options: { notice: "Signed in successfully!" }
I would prepare a PR with the change.