app/models/krikri/provider.rb in krikri-0.7.3 vs app/models/krikri/provider.rb in krikri-0.7.4
- old
+ new
@@ -152,13 +152,14 @@
def initialize_name
return nil unless valid_rdf_subject?
query_params = { :rows => 1,
:q => rdf_subject,
:qf => 'provider_id',
- :fl => 'provider_name' }
+ :fl => 'provider_name provider_id' }
response = Krikri::SolrResponseBuilder.new(query_params).response
return nil unless response.docs.count > 0
- response.docs.first['provider_name'].first
+ response.docs.first['provider_name'].respond_to?(:first) ?
+ response.docs.first['provider_name'].first : rdf_subject
end
##
# Creates DPLA::MAP::Agent object from the :rdf_subject and :name, ignoring
# bnodes.