Sha256: e543f53a22d10e89c172510d584fa8a0a9e5bce9c760888e90b98e3ab34113b0

Contents?: true

Size: 772 Bytes

Versions: 10

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  class SearchState < Blacklight::SearchState
    delegate :hyrax, :main_app, to: :controller

    # Override Blacklight so we can use the per-worktype routes
    # @param doc [#collection?, #model_name]
    def url_for_document(doc, _options = {})
      return [hyrax, doc] if doc.collection?
      [main_app, doc]
    end

    # The SPARQL gem stomps on the Rails definition of deep_dup and gives us a Hash instead of
    # a HashWithIndifferentAccess. This is an ugly workaround to get the right contract with
    # the upstream class.
    # https://github.com/ruby-rdf/sparql/blob/develop/lib/sparql/algebra/extensions.rb#L238-L244
    def to_hash
      super.with_indifferent_access
    end
    alias to_h to_hash
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyrax-5.0.1 lib/hyrax/search_state.rb
hyrax-5.0.0 lib/hyrax/search_state.rb
hyrax-5.0.0.rc3 lib/hyrax/search_state.rb
hyrax-5.0.0.rc2 lib/hyrax/search_state.rb
hyrax-5.0.0.rc1 lib/hyrax/search_state.rb
hyrax-4.0.0 lib/hyrax/search_state.rb
hyrax-4.0.0.rc3 lib/hyrax/search_state.rb
hyrax-4.0.0.rc2 lib/hyrax/search_state.rb
hyrax-4.0.0.rc1 lib/hyrax/search_state.rb
hyrax-4.0.0.beta2 lib/hyrax/search_state.rb