Created
October 20, 2011 17:03
-
-
Save valachi/1301670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#encoding: utf-8 | |
class ShowsController < ApplicationController | |
def index | |
@shows = Show.all | |
end | |
def show | |
@show = Show.find(params[:id]) | |
end | |
def new | |
@show = Show.new | |
end | |
def create | |
@show = Show.new(params[:show]) | |
if @show.save | |
redirect_to @show, notice: 'Новое шоу добавлено' | |
else | |
render :new | |
end | |
end | |
def edit | |
@show = Show.find(params[:id]) | |
end | |
def update | |
@show = Show.find(params[:id]) | |
if @show.update_attributes(params[:show]) | |
redirect_to @show, notice: 'Шоу успешно отредактировано' | |
else | |
render :edit | |
end | |
end | |
def destroy | |
@show = Show.find(params[:id]) | |
@show.destroy | |
redirect_to shows_path | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment