Sha256: 44d44286f18b6c208554b7d9c2d86b0d51369d00ecf88ad5645e31c12cd9c8e1

Contents?: true

Size: 305 Bytes

Versions: 2

Compression:

Stored size: 305 Bytes

Contents

module Ddr
  module HasParent
    extend ActiveSupport::Concern

    included do
      attribute :parent_id, Valkyrie::Types::ID.optional
    end

    def parent
      Ddr.query_service.find_by(id: parent_id) if parent_id
    end

    def publishable?
      parent&.published? || false
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddr-core-0.2.2 app/models/concerns/ddr/has_parent.rb
ddr-core-0.2.1 app/models/concerns/ddr/has_parent.rb