Nested routes, Listed tasks associated with projects
This commit is contained in:
22
app/controllers/projects_controller.rb
Normal file
22
app/controllers/projects_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class ProjectsController < ApplicationController
|
||||
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(project_params)
|
||||
if @project.save
|
||||
redirect_to @project
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user