CipherStash Documentation

Get a Record by its ID

If you know the ID of the record (or records) you need -- say, because you’ve gotten the IDs by association from another table -- you can fetch those records quickly and easily with Collection#get.

If you want to retrieve one record, pass its ID to #get as a string:

collection.get("<some UUID>")  # => CipherStash::Record or nil

If the record exists, it will be returned, otherwise you’ll get back nil.

If you have a list of IDs you want to get the records for, you can pass in those IDs as an array:

collection.get(["<some UUID>", "<some other UUID>", ...])

The return value in that case will be an array of CipherStash::Record objects, containing the records that existed with the IDs specified. If an ID doesn’t correspond to an extant record, then the returned array will just be one entry shorter.