Sha256: 1a91c79e2c4d54d81e58d4979f2b1f4ebca1dac4de5d24446d503e8c5c8168c0

Contents?: true

Size: 347 Bytes

Versions: 2

Compression:

Stored size: 347 Bytes

Contents

class SupportCategory < ApplicationRecord
  extend FriendlyId
  friendly_id :name, use: :slugged
  
  has_many :support_threads
  has_rich_text :description

  scope :sorted, ->{ order(position: :asc) }

  validates :name, :slug, :color, presence: true

  def color
    colour = super
    colour.start_with?("#") ? colour : "##{colour}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
help_center-0.0.7 app/models/support_category.rb
help_center-0.0.6 app/models/support_category.rb