Sha256: 31f0165669bfe17a2090f90e4a8c0629ec5e94fa57ee56fff716f25456ad9593

Contents?: true

Size: 281 Bytes

Versions: 9

Compression:

Stored size: 281 Bytes

Contents

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
simple_discussion-1.2.0 app/models/forum_category.rb
simple_discussion-1.0.1 app/models/forum_category.rb
simple_discussion-1.0.0 app/models/forum_category.rb
simple_discussion-0.9.5 app/models/forum_category.rb
simple_discussion-0.9.4 app/models/forum_category.rb
simple_discussion-0.9.3 app/models/forum_category.rb
simple_discussion-0.9.2 app/models/forum_category.rb
simple_discussion-0.9.1 app/models/forum_category.rb
simple_discussion-0.9.0 app/models/forum_category.rb