Files
subtle-storm/app/controllers/tasks_controller.rb
T
2025-07-12 17:50:56 +03:00

25 lines
465 B
Ruby

# frozen_string_literal: true
class TasksController < ApplicationController
before_action :fetch_task, only: %w[show edit update delete]
def index
if params[:project]
@project = Project.find_by!(code: params[:project])
@tasks = @project.tasks
else
@tasks = Task.all
end
@tasks = @tasks.includes(:project)
end
def show; end
private
def fetch_task
@task = Task.find_by_full_number_or_id!(params[:id])
end
end