Sha256: 776de40e7cf570c8d7b9c6d387ea02a350c6a2c68f14284aacd8092fb8fcc187

Contents?: true

Size: 467 Bytes

Versions: 4

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: [: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

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.12.1 app/models/thredded/category.rb
thredded-0.12.0 app/models/thredded/category.rb
thredded-0.11.1 app/models/thredded/category.rb
thredded-0.11.0 app/models/thredded/category.rb