Add to_label to preset warning model

This commit is contained in:
Matt Jankowski 2025-07-22 10:10:44 -04:00
parent 18a045e221
commit 63b79c302c

View File

@ -12,7 +12,15 @@
#
class AccountWarningPreset < ApplicationRecord
LABEL_TEXT_LENGTH = 30
validates :text, presence: true
scope :alphabetic, -> { order(title: :asc, text: :asc) }
def to_label
[title.presence, text.to_s.truncate(LABEL_TEXT_LENGTH)]
.compact
.join(' - ')
end
end