Module: Saucy::ProjectsController::InstanceMethods

Defined in:
lib/saucy/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'lib/saucy/projects_controller.rb', line 19

def create
  @project = .projects.build(params[:project])
  if @project.save
    flash[:notice] = "Project successfully created"
    redirect_to project_url(@project)
  else
    render :action => :new
  end
end

#destroyObject



46
47
48
49
50
# File 'lib/saucy/projects_controller.rb', line 46

def destroy
  current_project.destroy
  flash[:success] = "Project has been deleted"
  redirect_to (current_project.)
end

#editObject



29
30
31
# File 'lib/saucy/projects_controller.rb', line 29

def edit
  current_project
end

#indexObject



52
53
54
55
# File 'lib/saucy/projects_controller.rb', line 52

def index
  @active_projects = .projects.active
  @archived_projects = .projects.archived
end

#newObject



15
16
17
# File 'lib/saucy/projects_controller.rb', line 15

def new
  @project = .projects.build_with_default_permissions
end

#showObject



42
43
44
# File 'lib/saucy/projects_controller.rb', line 42

def show
  current_project
end

#updateObject



33
34
35
36
37
38
39
40
# File 'lib/saucy/projects_controller.rb', line 33

def update
  if current_project.update_attributes params[:project]
    flash[:success] = 'Project was updated.'
    redirect_to ()
  else
    render :action => :edit
  end
end