Displaying 1 result from an estimated 1 matches for "borrower_ssn".
2010 Jul 19
3
ActiveRecord override
Would really appreciate it if someone could tell me why this is happening:
I override ssn method of AR class so I can encrypt/decrypt to/from the db:
class Person < ActiveRecord::Base
def ssn=(value)
write_attribute(:borrower_ssn, Crypto.encrypt(self.encryption_key,
value))
write_attribute(:borrower_ssn_final_four, value[5,4])
end
def ssn
# this begin - rescue can be removed once all data is encrypted
begin
return Crypto.decrypt(self.encryption_key,
read_attribute(:borrower_ssn)) if read_attribute(:bo...