Module: Saucy::ProjectsController

Extended by:
ActiveSupport::Concern
Included in:
ProjectsController
Defined in:
lib/saucy/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


23
24
25
26
27
28
29
30
# File 'lib/saucy/projects_controller.rb', line 23

def create
  @project = .projects.build(params[:project])
  if @project.save
    redirect_to (, @project)
  else
    render :action => :new
  end
end

#destroyObject


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

def destroy
  current_project.destroy
  redirect_to (current_project.), :notice => "Project has been deleted"
end

#editObject


32
33
34
35
# File 'lib/saucy/projects_controller.rb', line 32

def edit
  @project = current_project
  
end

#indexObject


56
57
58
59
# File 'lib/saucy/projects_controller.rb', line 56

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

#newObject


16
17
18
19
20
21
# File 'lib/saucy/projects_controller.rb', line 16

def new
  @project = .projects.build_with_default_permissions
  if @project.keyword.blank?
    @project.keyword = 'keyword'
  end
end

#showObject


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

def show
  current_project
end

#updateObject


37
38
39
40
41
42
43
44
45
# File 'lib/saucy/projects_controller.rb', line 37

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