RoR: cannot get started with ezcrypto / ActiveCrypto
I want to encrypt a field stored in an ActiveRecord table. A few helpful people pointed me towards ezcrypto which appears to be what I want. Especially interesting is ActiveCrypto, as described in ezcrypto.rubyforge.org/files/README_ACTIVE_CR开发者_开发百科YPTO.html
But I can't get it working. I've added
gem 'ezcrypto', '0.7.2'
to my Gemfile, run bundle install
, and extended my User model with:
require 'ezcrypto'
class User < ActiveRecord::Base
...
keyholder
...
end
but that dies with undefined local variable or method 'keyholder'
.
Ideas on how to get this working? TIA.
While I was digging around for an answer, I came upon attr_encrypted, which
- is actively supported
- does what I need
- worked the first time
So I don't need an answer to the OP (unless you feel compelled to do so...). Hope this helps someone else.
精彩评论