Sha256: 6c7f11a717da5d44d33101fea399a046fe9435e74f511e7e346c008455726b12

Contents?: true

Size: 777 Bytes

Versions: 28

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # Provide the ActiveModel methods so that this object routes the same as the
  # object represented by the solr document.
  module ModelProxy
    delegate :to_param, :to_key, :id, to: :solr_document
    delegate :model_name, :to_partial_path, to: :_delegated_to

    def persisted?
      true
    end

    def to_model
      self
    end

    ##
    # @deprecated this isn't related to the ModelProxy issue, and has been moved
    #   to `WorkShowPresenter`.
    def valid_child_concerns
      Deprecation.warn "#{self.class}#valid_child_concerns will be removed in Hyrax 4.0."
      Hyrax::ChildTypes.for(parent: solr_document.hydra_model)
    end

    private

    def _delegated_to
      solr_document.to_model
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
hyrax-5.0.4 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.3 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.2 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.1 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.0 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.0.rc3 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.0.rc2 app/presenters/hyrax/model_proxy.rb
hyrax-5.0.0.rc1 app/presenters/hyrax/model_proxy.rb
hyrax-3.6.0 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0.rc3 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0.rc2 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0.rc1 app/presenters/hyrax/model_proxy.rb
hyrax-3.5.0 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0.beta2 app/presenters/hyrax/model_proxy.rb
hyrax-3.4.2 app/presenters/hyrax/model_proxy.rb
hyrax-4.0.0.beta1 app/presenters/hyrax/model_proxy.rb
hyrax-3.4.1 app/presenters/hyrax/model_proxy.rb
hyrax-3.4.0 app/presenters/hyrax/model_proxy.rb
hyrax-3.3.0 app/presenters/hyrax/model_proxy.rb