Skip to content
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

Settings in config/initilizers/devise.rb for Turbo? #5491

Closed
scarroll32 opened this issue May 9, 2022 · 2 comments
Closed

Settings in config/initilizers/devise.rb for Turbo? #5491

scarroll32 opened this issue May 9, 2022 · 2 comments

Comments

@scarroll32
Copy link

Environment

  • Ruby 3.0.4
  • Rails 7.0.2.4
  • Devise 4.8.1

Current behavior

config/initilizers/devise.rb includes this commented text.

  # ==> Turbolinks configuration
  # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
  #
  # ActiveSupport.on_load(:devise_failure_app) do
  #   include Turbolinks::Controller
  # end

Expected behavior

Good question: What should the settings be for an app with Turbo?

@carlosantoniodasilva
Copy link
Member

Devise currently does not support Turbo, there's some changes required. You can check #5340 and a couple other PRs that have done some work to add support for it, but initially I'd recommend simply disabling turbo if you can in the devise views, e.g. something like #5487.

We'll likely release a version disabling it by default before we have a final fully supported version, just to avoid confusion with new apps.

@Firebeam
Copy link

I managed to get it working, but I'd lie if I say I came up with it. I saw somewhere this clever piece of code (add on config/initializers/devise.rb:

config.navigational_formats = ['*/*', :html, :turbo_stream]

I only tried it with the logout link, provided that you add a data: { turbo_method: :delete } attribute. Not sure if other functionalities work, but it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants