Sha256: 7b14f10c8d7576d7d721266a51562c9975938ea57c9b1c05195582aaa794e498

Contents?: true

Size: 287 Bytes

Versions: 4

Compression:

Stored size: 287 Bytes

Contents

class SupportCategory < ApplicationRecord
  extend FriendlyId
  friendly_id :name, use: :slugged

  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

4 entries across 4 versions & 1 rubygems

Version Path
help_center-0.0.4 app/models/support_category.rb
help_center-0.0.3 app/models/support_category.rb
help_center-0.0.2 app/models/support_category.rb
help_center-0.0.1 app/models/support_category.rb