Sha256: 67d1c39424642217f1b1148cf1c7f0565385a31a6ca7835992f76ab50c34f26f

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

module KnowledgeBase::Concerns::Models::Sectionables::List
  extend ActiveSupport::Concern

  included do
    mount_uploader :image, KnowledgeBase.config.list_image_uploader

    has_many :items, -> { order 'position ASC' }

    has_many :sections, as: :sectionable, dependent: :destroy

    accepts_nested_attributes_for :items, allow_destroy: true

    def to_s
      "#{super} ##{id}: #{title}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knowledge_base-0.2.0 lib/knowledge_base/concerns/models/sectionables/list.rb