To perform queries over your encrypted records, you can use the query method.
For example, to find a user by email address:
This will return an ActiveStash::Relation which extends ActiveRecord::Relation so you can chain most methods as you normally would!
To constrain by multiple fields, include them in the hash:
User.query(email: "firstname.lastname@example.org", verified: true)
To order by dob, do:
Or to use limit and offset:
This means that ActiveStash should work with pagination libraries like Kaminari.
You also, don’t have to provide any constraints at all and just use the encrypted indexes for ordering!
To order all records by dob descending and then created_at, do (note the call to query with no args first):
User.query.order(dob: :desc, :created_at)
For more information visit the ActiveStash Ruby docs.