tag.rb 257 B

12345678910111213
  1. # frozen_string_literal: true
  2. class Tag < ApplicationRecord
  3. has_and_belongs_to_many :statuses
  4. HASHTAG_RE = /(?:^|[^\/\w])#([[:word:]_]*[[:alpha:]_][[:word:]_]*)/i
  5. validates :name, presence: true, uniqueness: true
  6. def to_param
  7. name
  8. end
  9. end