Files
fizzy/app/models/tag.rb
T
2025-04-09 14:50:58 +02:00

18 lines
391 B
Ruby

class Tag < ApplicationRecord
include Filterable
belongs_to :account, default: -> { Current.account }, touch: true
has_many :taggings, dependent: :destroy
has_many :cards, through: :taggings
validates :title, format: { without: /\A#/ }
normalizes :title, with: -> { it.downcase }
scope :alphabetically, -> { order("lower(title)") }
def hashtag
"#" + title
end
end