Class: ProjectsController

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

Instance Method Summary collapse

Instance Method Details

#branchesObject



29
30
31
# File 'app/controllers/projects_controller.rb', line 29

def branches
  render json: current_user.projects.find(params[:project_id]).branches, root: :jobs
end

#createObject



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

def create
  render json: Project.add_project(current_user, params[:name])
end

#destroyObject



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

def destroy
  render json: current_user.projects.find(params[:id]).destroy!
end

#indexObject



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

def index
  render json: current_user.projects
end

#jobsObject



25
26
27
# File 'app/controllers/projects_controller.rb', line 25

def jobs
  render json: current_user.projects.find(params[:project_id]).jobs
end

#showObject



11
12
13
# File 'app/controllers/projects_controller.rb', line 11

def show
  render json: current_user.projects.find(params[:id])
end

#updateObject



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

def update
  project = current_user.projects.find(params[:id])
  project.update!(safe_params)
  render json: project
end