Sha256: d9312010525d28009f2751cb9167efd57bef47d64c63803a80da44c2f88c1580

Contents?: true

Size: 467 Bytes

Versions: 22

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class Category < ActiveRecord::Base
    extend FriendlyId
    belongs_to :messageboard
    has_many :topic_categories
    has_many :topics, through: :topic_categories
    friendly_id :name, use: %i[history scoped], scope: :messageboard

    validates :name, presence: true
    validates :messageboard_id, presence: true

    def normalize_friendly_id(input)
      Thredded.slugifier.call(input.to_s)
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
thredded-0.12.3 app/models/thredded/category.rb
thredded-0.12.2 app/models/thredded/category.rb