Sha256: 13a466b0f1edefc3d824d6cb87a26f8265e8801fb607f374a39943916379cf5c

Contents?: true

Size: 394 Bytes

Versions: 1

Compression:

Stored size: 394 Bytes

Contents

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

  included do
    has_many :links, dependent: :destroy, foreign_key: :links_id

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

    accepts_nested_attributes_for :links, allow_destroy: true

    def to_s
      "#{super} ##{id}: #{links.map(&:title).join(', ')}"
    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/links/list.rb