lib/scrivito/obj_collection.rb in scrivito_sdk-0.71.2 vs lib/scrivito/obj_collection.rb in scrivito_sdk-0.90.0.rc1

- old
+ new

@@ -27,24 +27,41 @@ # @api public def find_including_deleted(id_or_list) find_using(id_or_list, :find_by_including_deleted) end - # Find the {BasicObj Obj} that has the given path. - # Returns +nil+ if no matching object exists. - # @param [String] path Path of the {BasicObj Obj}. - # @return [Obj,NilClass] + # + # Find the {Scrivito::BasicObj Obj} that has the given +path+. + # # @api public + # + # @note If there is more than one {Scrivito::BasicObj Obj} with the given +path+, + # then the {Scrivito::BasicObj Obj} with the smallest +id+ will be returned. + # + # @param [String] path Path of the {Scrivito::BasicObj Obj}. + # + # @return [Scrivito::BasicObj] if an {Scrivito::BasicObj Obj} with the given +path+ exists. + # @return [NilClass] if no {Scrivito::BasicObj Obj} with the given +path+ exists. + # def find_by_path(path) - find_by(:path, [path]).first.first + find_by(:path, [path]).first.min_by(&:id) end - # Returns the {BasicObj Obj} that has the given permalink, or +nil+ if no matching object exists. - # @param [String] permalink The permalink of the {BasicObj Obj}. - # @return [Obj,NilClass] + # + # Returns the {Scrivito::BasicObj Obj} that has the given +permalink+. + # # @api public + # + # @note If there is more than one {Scrivito::BasicObj Obj} with the given +permalink+, + # then the {Scrivito::BasicObj Obj} with the smallest +id+ will be returned. + # + # @param [String] permalink The permalink of the {BasicObj Obj}. + # + # @return [Scrivito::BasicObj] if an {Scrivito::BasicObj Obj} with the given +permalink+ exists. + # @return [NilClass] if no {Scrivito::BasicObj Obj} with the given +permalink+ exists. + # def find_by_permalink(permalink) - find_by(:permalink, [permalink]).first.first + find_by(:permalink, [permalink]).first.min_by(&:id) end # Returns an {ObjSearchEnumerator} with the given initial subquery consisting of the four arguments. # # Note that +field+ and +value+ may also be arrays for searching several fields or searching for several values.