Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 4b554ece66
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (35 sloc) 0.859 kB
class CompaniesController < ApplicationController
def index
@companies = Company.all
end
def show
@company = Company.find(params[:id])
end
def new
@company = Company.new
end
def create
@company = Company.new(params[:company])
if @company.save
redirect_to @company, :notice => "Successfully created company."
else
render :action => 'new'
end
end
def edit
@company = Company.find(params[:id])
end
def update
@company = Company.find(params[:id])
if @company.update_attributes(params[:company])
redirect_to @company, :notice => "Successfully updated company."
else
render :action => 'edit'
end
end
def destroy
@company = Company.find(params[:id])
@company.destroy
redirect_to companies_url, :notice => "Successfully destroyed company."
end
end
Jump to Line
Something went wrong with that request. Please try again.