Module: Saucy::ProjectsController::InstanceMethods

Defined in:
lib/saucy/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

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

#editObject



34
35
36
37
# File 'lib/saucy/projects_controller.rb', line 34

def edit
  @project = current_project
  
end

#indexObject



60
61
62
63
# File 'lib/saucy/projects_controller.rb', line 60

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

#newObject



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

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

#showObject



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

def show
  current_project
end

#updateObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/saucy/projects_controller.rb', line 39

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