Skip to content

Commit

Permalink
Update asset_resource_indexer.rb
Browse files Browse the repository at this point in the history
conditional check for nil or blank to avoid nil:NilClass errors
  • Loading branch information
ekemeyer authored Aug 27, 2024
1 parent 560be6a commit f5dbf3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/indexers/asset_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def to_solr
AnnotationTypesService.new.select_all_options.each do |type|
# Use the ID defined in the AnnotationType service
type_id = type[1]
index_document["#{type_id.underscore}_ssim"] = resource.try(type_id.to_sym) unless resource.try(type_id.to_sym).blank?
unless resource.try(type_id.to_sym).nil? || resource.try(type_id.to_sym).blank?
index_document ["#{type_id.underscore}_ssim"] = resource.try(type_id.to_sym)
end

#Indexing for search by batch_id
Expand Down

0 comments on commit f5dbf3f

Please sign in to comment.