Skip to content

Instantly share code, notes, and snippets.

@sterrym
Created October 7, 2010 18:17
Show Gist options
  • Save sterrym/615589 to your computer and use it in GitHub Desktop.
Save sterrym/615589 to your computer and use it in GitHub Desktop.
class TheatresController < ApplicationController
def index
@theatre = Theatre.all
end
def new
@theatre = Theatre.new(params[:theatre])
end
def create
@theatre = Theatre.new(params[:theatre])
if @theatre.saved
notice = "Saved successfully!"
redirect_to [:admin, :theatres]
else
render :action => "new"
end
end
def edit
@theatre = Theatre.find(params[:id])
end
def update
@theatre = Theatre.find(params[:id])
if @theatre.update_attributes(params[:theatre])
notice = "Saved successfully!"
redirect_to [:admin, :theatres]
else
render :action => "edist"
end
end
def destroy
@theatre = Theatre.find(params[:id])
@theatre.destroy
notice = "Deleted record"
redirect_to [:admin, :theatres]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment