Skip to content

Commit

Permalink
remove messages
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Nov 11, 2021
1 parent 9c238c6 commit b03bb33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def update
def destroy
@message.destroy
respond_to do |format|
format.turbo_stream { render turbo_stream: turbo_stream.remove(@message) }
# format.turbo_stream { render turbo_stream: turbo_stream.remove("message_#{@message.id}") }
format.html { redirect_to messages_url, notice: "Message was successfully destroyed." }
format.json { head :no_content }
end
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</head>

<body>
<%= Time.zone.now %>
<%= yield %>
</body>
</html>
1 change: 1 addition & 0 deletions app/views/messages/_message.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

<p>
<%= link_to "Show this message", message %>
<%= button_to "Destroy this message", message_path(message), method: :delete %>
</p>
</div>

0 comments on commit b03bb33

Please sign in to comment.