Skip to content

Commit

Permalink
Merge pull request #43 from Henry1776/tarea_14
Browse files Browse the repository at this point in the history
added button delete rooms #14
  • Loading branch information
KarlHeitmann authored May 16, 2021
2 parents 7e42477 + e7dc1e9 commit cd77e0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def new
@room = Room.new
end

def destroy
@room = Room.find(params[:id])
@room.destroy
redirect_to rooms_path
end

def create
@room = Room.new permitted_parameters

Expand Down
2 changes: 2 additions & 0 deletions app/views/rooms/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<h1><%= @room.name %></h1>
<%= link_to 'Encuestas', room_surveys_path(@room), class: "btn btn-primary mb-3" %>
<%= link_to 'New survey', new_room_survey_path(@room), class: "btn btn-primary mb-3" %>
<%= link_to 'Delete Room', room_path(@room), method: :delete, class: "btn btn-danger mb-3" %>

<div class="chat" id="chat-box">
<%= turbo_stream_from "room-#{@room.id}" %>
<%= turbo_frame_tag "room_messages" do %>
Expand Down

0 comments on commit cd77e0b

Please sign in to comment.