Class: TasksController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- TasksController
- Defined in:
- app/controllers/tasks_controller.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) create
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/tasks_controller.rb', line 15 def create @task.project_id = @test.project_id if @task.save render json: @task, status: :created else render json: { errors: @task.errors }, status: :unprocessable_entity end end |
- (Object) destroy
35 36 37 38 39 |
# File 'app/controllers/tasks_controller.rb', line 35 def destroy @task.deleted = true @task.save head :no_content end |
- (Object) index
11 12 13 |
# File 'app/controllers/tasks_controller.rb', line 11 def index render json: @tasks.sort_by { |t| t.id }, status: :ok end |
- (Object) show
25 26 27 |
# File 'app/controllers/tasks_controller.rb', line 25 def show render json: @task, status: :ok end |
- (Object) update
29 30 31 32 33 |
# File 'app/controllers/tasks_controller.rb', line 29 def update @task.update_attributes(task_params) render json: @task, status: :ok end |