Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 60349565ef
Fetching contributors…

Cannot retrieve contributors at this time

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