Class: ProjectsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- ProjectsController
- Defined in:
- app/controllers/projects_controller.rb
Instance Method Summary collapse
- #branches ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #jobs ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#branches ⇒ Object
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 |
#create ⇒ Object
7 8 9 |
# File 'app/controllers/projects_controller.rb', line 7 def create render json: Project.add_project(current_user, params[:name]) end |
#destroy ⇒ Object
21 22 23 |
# File 'app/controllers/projects_controller.rb', line 21 def destroy render json: current_user.projects.find(params[:id]).destroy! end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/projects_controller.rb', line 3 def index render json: current_user.projects end |
#jobs ⇒ Object
25 26 27 |
# File 'app/controllers/projects_controller.rb', line 25 def jobs render json: current_user.projects.find(params[:project_id]).jobs end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/projects_controller.rb', line 11 def show render json: current_user.projects.find(params[:id]) end |
#update ⇒ Object
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 |