Class: ProjectsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/projects_controller.rb', line 12

def create
  @project = current_user.projects.build(project_params)

  if @project.save
    redirect_to root_path
  else
    render :new
  end
end

#indexObject



4
5
6
# File 'app/controllers/projects_controller.rb', line 4

def index
  @projects = Project.all
end

#newObject



8
9
10
# File 'app/controllers/projects_controller.rb', line 8

def new
  @project = current_user.projects.build
end

#showObject



22
23
24
# File 'app/controllers/projects_controller.rb', line 22

def show
  @project = Project.find params[:id]
end