Skip to content

Commit

Permalink
Fix troubles related to turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
wakairo committed Mar 21, 2022
1 parent 4c08d43 commit 413340a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/users_controller.rb
Expand Up @@ -22,7 +22,7 @@ def create
flash[:success] = "User created"
redirect_to @user
else
render 'new'
render 'new', status: :unprocessable_entity
end
end

Expand All @@ -32,14 +32,14 @@ def update
flash[:success] = "User updated"
redirect_to @user
else
render 'edit'
render 'edit', status: :unprocessable_entity
end
end

def destroy
User.find(params[:id]).destroy
flash[:success] = "User deleted"
redirect_to users_url
redirect_to users_url, status: :see_other
end

private
Expand Down
3 changes: 1 addition & 2 deletions app/views/users/_user.html.erb
@@ -1,6 +1,5 @@
<li>
<%= link_to user.name, user %>
| <%= link_to "delete", user,
method: :delete,
data: { confirm: "You sure?" } %>
data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>
</li>

0 comments on commit 413340a

Please sign in to comment.