Created
February 5, 2010 21:27
-
-
Save aeden/296266 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 PeopleController < ApplicationController | |
| def index | |
| @people = Person.all | |
| end | |
| def create | |
| @person = Person.new(params[:person]) | |
| @person.save! | |
| respond_to do |format| | |
| format.html { redirect_to people_url } | |
| format.json { render :json => @person } | |
| end | |
| rescue ActiveRecord::RecordInvalid => e | |
| render :action => 'new' | |
| end | |
| def delete | |
| @person = Person.find(params[:id]) | |
| end | |
| def destroy | |
| @person = Person.find(params[:id]) | |
| @person.destroy | |
| respond_to do |format| | |
| format.html { redirect_to people_url } | |
| format.json { render :json => true } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment