Sha256: 89882ceedf57ef9ad8c88a9d309b72a21a2dd52c62e1a9562733e09a55d7e8c4

Contents?: true

Size: 341 Bytes

Versions: 5

Compression:

Stored size: 341 Bytes

Contents

module Ddr
  module HasParent
    extend ActiveSupport::Concern

    included do
      class_attribute :parent_class
      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

5 entries across 5 versions & 1 rubygems

Version Path
ddr-core-1.1.2 app/models/concerns/ddr/has_parent.rb
ddr-core-1.1.1 app/models/concerns/ddr/has_parent.rb
ddr-core-1.1.0 app/models/concerns/ddr/has_parent.rb
ddr-core-1.0.0 app/models/concerns/ddr/has_parent.rb
ddr-core-0.3.0 app/models/concerns/ddr/has_parent.rb