Created
April 11, 2017 23:20
-
-
Save geocodinglife/3acad696d714d09770c063426395f257 to your computer and use it in GitHub Desktop.
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
class RoomsController < ApplicationController | |
def index | |
@rooms = Room.all | |
end | |
def show | |
@room = Room.find(params[:id]) | |
end | |
def new | |
@room = Room.new | |
end | |
def edit | |
@room = Room.find(params[:id]) | |
end | |
def create | |
@room = Room.new(room_params) | |
if @room.save | |
redirect_to @room | |
else | |
render 'new' | |
end | |
end | |
def update | |
@room = Room.find(params[:id]) | |
if @room.update(room_params) | |
redirect_to @room | |
else | |
render 'edit' | |
end | |
end | |
def destroy | |
@room = Article.find(params[:id]) | |
@room.destroy | |
redirect_to articles_path | |
end | |
private | |
def article_params | |
params.require(:article).permit(:title, :text) | |
end | |
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
#pending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment