Skip to content

Instantly share code, notes, and snippets.

@nchapman
Created March 12, 2012 16:14
Show Gist options
  • Save nchapman/2023064 to your computer and use it in GitHub Desktop.
Save nchapman/2023064 to your computer and use it in GitHub Desktop.
class OrganizationsController < ApplicationController
def index
@organizations = Organization.all
respond_with(@organizations)
end
def show
@organization = Organization.find(params[:id])
respond_with(@organization)
end
def new
@organization = Organization.new
respond_with(@organization)
end
def edit
@organization = Organization.find(params[:id])
end
def create
@organization = Organization.new(params[:organization])
@organization.save
respond_with(@organization)
end
def update
@organization = Organization.find(params[:id])
@organization.update_attributes(params[:organization])
respond_with(@organization)
end
def destroy
@organization = Organization.find(params[:id])
@organization.destroy
respond_with(@organization)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment