Files
subtle-storm/app/services/tasks/update.rb
T
2025-07-14 01:31:08 +03:00

23 lines
424 B
Ruby

# frozen_string_literal: true
module Tasks
class Update < ApplicationService
attribute :id, :integer
attribute :title, :string
attribute :description, :string
validates :title, presence: true
delegate :model_name, to: Task
def persisted? = true
def perform(task)
@task = task
@id = task.id
@task.assign_attributes(title:, description:)
save @task
end
end
end