Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails 7, Devise in turbo_frames

Nick McNeany asked in Rails
  • Rails 7.0.6
  • Devise 4.9

Summary

  • I have a pretty standard Devise setup with links in a global navbar that look like this.

    <%= link_to('Create account', new_user_registration_path, data: {turbo_frame: 'auth-modal'} ) %>
    
    <%= link_to('Sign in', new_user_session_path, data: {turbo_frame: 'auth-modal'} ) %>
    
  • In my application.html.erb, I have a turbo_frame_tag

    <%= turbo_frame_tag('auth-modal') %>
    
  • My Devise templates have the correct corresponding tags

    <%= turbo_frame_tag('auth-modal') do %>
    Devise new session form / Devise new registration form
    <% end %>
    

    I also have the necessary css in place to make the frame look an actual modal when displayed.

  • When clicking the links in the navbar the Sign in/log in templates do show as expected, styled as a modal. And I can sign up and login as expected.

The issue

The majority of my pages show certain content for logged out users and user specific content for logged in users. I'm trying to figure out how to update the current page, after a successful login or registration to show the new user specific content instead of the generic content. If I manually refresh the page everything works as expected. Obviously that's not ideal to make user refresh the page after logging in.

Thanks for any help in advance, and please let me know if anything is unclear!

Reply

~n|m

Reply

Did you solve the problem?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,256+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.