reidmorrison/symmetric-encryption — pull request #27 by astjohn (2014-01-26 23:48:43+00:00)
Title: Fix decrypt_as logic for mongoid fields

There was a minor issue when using the `decrypt_as` option when specifying a mongoid field with an `alias`.
The original check was:
```
if decrypted_field_name.nil? && encrypted_field_name.to_s.start_with?('encrypted_')
```

However, this will always return false for the following field definition:

```
field :ad1, type: String, encrypted: {decrypt_as: :address1, random_iv: true}
```

Since the field name is *ad1*, the condition will return false despite the fact that the `decrypt_as` option was given, and an error will be raised. I don't think the intention was to check that the field name starts with *encrypted_* if `decrypt_as` is given. Am I correct?

This quick change should fix the issue.