README.md in lockbox-0.3.7 vs README.md in lockbox-0.4.0

- old
+ new

@@ -203,10 +203,12 @@ User.create!(email: "hi@example.org") ``` If you need to query encrypted fields, check out [Blind Index](https://github.com/ankane/blind_index). +You can [migrate existing data](#migrating-existing-data) similarly to Active Record. + ## Active Storage Add to your model: ```ruby @@ -376,11 +378,11 @@ ## Key Rotation To make key rotation easy, you can pass previous versions of keys that can decrypt. -### Active Record +### Active Record & Mongoid Update your model: ```ruby class User < ApplicationRecord @@ -396,30 +398,10 @@ Lockbox.rotate(User, attributes: [:email]) ``` Once all records are rotated, you can remove `previous_versions` from the model. -### Mongoid - -Update your model: - -```ruby -class User - encrypts :email, previous_versions: [{key: previous_key}] -end -``` - -Use `master_key` instead of `key` if passing the master key. - -To rotate existing records, use: - -```ruby -Lockbox.rotate(User, attributes: [:email]) -``` - -Once all records are rotated, you can remove `previous_versions` from the model. - ### Active Storage Update your model: ```ruby @@ -460,12 +442,12 @@ end ``` Once all files are rotated, you can remove `previous_versions` from the model. -### Strings +### Local Files & Strings -For strings, use: +For local files and strings, use: ```ruby Lockbox.new(key: key, previous_versions: [{key: previous_key}]) ```