Created
February 2, 2012 15:09
-
-
Save hakagura/1723892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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