Skip to content

Instantly share code, notes, and snippets.

@hakagura
Created February 2, 2012 15:09
Show Gist options
  • Save hakagura/1723892 to your computer and use it in GitHub Desktop.
Save hakagura/1723892 to your computer and use it in GitHub Desktop.
class ProjectsController < ApplicationController
before_filter :authenticate_user!
respond_to :html
def index
@projects = Project.all
end
def show
@project = Project.find(params[:id])
end
def new
@project = Project.new
end
def create
@project = Project.new(params[:project])
if @project.save
redirect_to projects_url
else
render :action => 'new'
end
end
def edit
@project = Project.find(params[:id])
end
def update
@project = Project.find(params[:id])
if @project.update_attributes(params[:project])
redirect_to @project, :notice => "Successfully updated."
else
render :action => 'edit'
end
end
def destroy
@project = Project.find(params[:id])
@project.destroy
redirect_to projects_url, :notice => "Successfully destroyed."
end
def closed_task
@task=Task.find(params[:task_id])
@task.update_attributes(:status,"Closed")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment