forked from hmlON/room538
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add edit, update and destroy actions to rooms controller
- Loading branch information
Showing
8 changed files
with
59 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
= form_for(room) do |f| | ||
= form_for(room, url: rooms_path) do |f| | ||
.field | ||
= f.label :name | ||
br | ||
= f.text_field :name | ||
.actions | ||
= f.submit 'Create room' | ||
= f.submit submit_button_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
h1 Rooms#edit | ||
p Find me in app/views/rooms/edit.html.slim | ||
h1 Edit your room | ||
|
||
= render partial: 'form', locals: { room: @room, submit_button_text: 'Update room' } | ||
|
||
= link_to 'Destroy your room', rooms_path, method: :delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
h3 New room | ||
|
||
= render partial: 'form', locals: { room: @room } | ||
= render partial: 'form', locals: { room: @room, submit_button_text: 'Create room' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
Rails.application.routes.draw do | ||
root 'pages#index' | ||
resources :rooms | ||
resources :rooms, only: [:index, :new, :create] | ||
get '/rooms/edit' => 'rooms#edit', as: 'edit_room' | ||
put '/rooms' => 'rooms#update' | ||
delete '/rooms' => 'rooms#destroy' | ||
devise_for :users | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters