app/models/concerns/blacklight/document.rb in blacklight-6.7.0 vs app/models/concerns/blacklight/document.rb in blacklight-6.7.1

- old
+ new

@@ -42,10 +42,15 @@ attr_reader :response, :_source alias_method :solr_response, :response delegate :[], :key?, :keys, :to_h, to: :_source def initialize(source_doc={}, response=nil) - @_source = ActiveSupport::HashWithIndifferentAccess.new(source_doc) + @_source = if source_doc.respond_to?(:to_hash) + ActiveSupport::HashWithIndifferentAccess.new(source_doc) + else + Deprecation.warn(Blacklight::Document, "Blacklight::Document#initialize expects a hash-like object, received #{source_doc.class}.") + ActiveSupport::HashWithIndifferentAccess.new(source_doc.to_h) + end @response = response apply_extensions end # the wrapper method to the @_source object.