reidmorrison/symmetric-encryption — pull request #22 by gaizka (2013-12-30 13:03:50+00:00)
Title: Define encrypted ActiveRecord methods inside a module, so we can use super

(pattern extracted from: http://thepugautomatic.com/2013/07/dsom/ )

You can then, for example, migrate to encrypted records one by one, when they change:

```
class EncryptBankAccount < ActiveRecord::Migration
def change
rename_column :users, :bank_account_number, :clear_bank_account_number
add_column :users, :encrypted_bank_account_number, :text
end
end

class User < ActiveRecord::Base
attr_encrypted :bank_account_number
def bank_account_number
super || clear_bank_account_number
end
end
```

And later, drop the `clear_bank_account_numner` and delete the `bank_account_number` method.