Skip to content

Commit

Permalink
fix for turbo stream
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Apr 19, 2023
1 parent 0af2b71 commit 87228c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/devise/invitations_controller.rb
Expand Up @@ -31,7 +31,7 @@ def create
respond_with resource, location: after_invite_path_for(current_inviter, resource)
end
else
respond_with_navigational(resource) { render :new, status: :unprocessable_entity }
respond_with(resource)
end
end

Expand Down Expand Up @@ -63,7 +63,7 @@ def update
end
else
resource.invitation_token = raw_invitation_token
respond_with_navigational(resource) { render :edit, status: :unprocessable_entity }
respond_with(resource)
end
end

Expand Down

2 comments on commit 87228c1

@supairish
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scambra This appears to break any Rails 7 apps still using rails-ujs and remote: true on their invite form. /users/invitations/new.html template will get picked up rather than /users/invitations/new.js javascript template. In my use case I have a new.js template that does a bunch of JS updates and renders new.html into a modal, so both files exist side by side.

@scambra
Copy link
Owner Author

@scambra scambra commented on 87228c1 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devise doesn't use respond_with_navigational on create or update actions, they changed to use respond_with many years ago, so I think is the way to go. If you change the view in your app to use rails-ujs with remote: true, controller may need changes too.

Please sign in to comment.