diff --git a/lib/active_fedora/querying.rb b/lib/active_fedora/querying.rb index 00cc2447a..d3a81d7cd 100644 --- a/lib/active_fedora/querying.rb +++ b/lib/active_fedora/querying.rb @@ -68,13 +68,14 @@ def find_each( conditions={}, opts={}) end - # Returns true if the pid exists in the repository - # @param[String] pid - # @return[boolean] + # Returns true if the pid exists in the repository + # @param[String] pid + # @return[boolean] def exists?(pid) return false if pid.nil? || pid.empty? - inner = DigitalObject.find_or_initialize(self, pid) - !inner.new? + !!DigitalObject.find(self, pid) + rescue ActiveFedora::ObjectNotFoundError + false end # Returns a solr result matching the supplied conditions