Basis of rails-driven app for local business
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

44 lines
869 B

class PeopleController < ApplicationController
def index
@people = Person.all
end
def show
@person = Person.find(params[:id])
end
def new
@person = Person.new
end
def create
@person = Person.new(params[:person])
if @person.save
flash[:notice] = "Successfully created person."
redirect_to @person
else
render :action => 'new'
end
end
def edit
@person = Person.find(params[:id])
end
def update
@person = Person.find(params[:id])
if @person.update_attributes(params[:person])
flash[:notice] = "Successfully updated person."
redirect_to @person
else
render :action => 'edit'
end
end
def destroy
@person = Person.find(params[:id])
@person.destroy
flash[:notice] = "Successfully destroyed person."
redirect_to people_url
end
end