Skip to content

Instantly share code, notes, and snippets.

@valachi
Created October 20, 2011 17:03
Show Gist options
  • Save valachi/1301670 to your computer and use it in GitHub Desktop.
Save valachi/1301670 to your computer and use it in GitHub Desktop.
#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