Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (36 sloc) 0.86 kb
class ProjectsController < ApplicationController
before_filter :authenticate_user!, except :index
def index
@projects = Project.all
end
def show
@project = Project.find(params[:id])
end
def new
@project = Project.new
end
def edit
@project = Project.find(params[:id])
end
def create
@project = Project.new(params[:project])
if @project.save
redirect_to @project, notice: 'Project was successfully created.'
else
render action: "new"
end
end
def update
@project = Project.find(params[:id])
if @project.update_attributes(params[:project])
redirect_to @project, notice: 'Project was successfully updated.'
else
render action: "edit"
end
end
def destroy
@project = Project.find(params[:id])
@project.destroy
redirect_to projects_url
end
end
Jump to Line
Something went wrong with that request. Please try again.