This way screen reader users will know which record they're going to access when focusing on a link to a certain action. Otherwise they'd hear something like "Edit, link", and they wouldn't know which record they'll end up editing if they follow the link.
16 lines
373 B
Ruby
16 lines
373 B
Ruby
class Dashboard::AdministratorTask < ApplicationRecord
|
|
belongs_to :source, polymorphic: true
|
|
belongs_to :user
|
|
|
|
validates :source, presence: true
|
|
|
|
default_scope { order(created_at: :asc) }
|
|
|
|
scope :pending, -> { where(executed_at: nil) }
|
|
scope :done, -> { where.not(executed_at: nil) }
|
|
|
|
def title
|
|
"#{source.proposal.title} #{source.action.title}"
|
|
end
|
|
end
|