Created
October 7, 2010 18:17
-
-
Save sterrym/615589 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
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