Here's two commands while using attr_encrypted:
# Seed fails to populate encrypted fields
rake db:drop db:create db:migrate db:seed
# Seed succeeds
rake db:drop db:create db:migrate
rake db:seed
When I say that seed 'fails', I mean that the encrypted fields are all blank. When it succeeds, the encrypted fields are populated.
An example from the seeds file:
Company.create_with(
key: "12345"
).find_or_create_by(
name: "Acme Inc."
)
Why is this happening, and how can I make sure seeds works every time?