[Sentry]-before_validation(model) not working for crypted-at


#1

I am still trying to get sentry working to encrypt a couple of
attributes in the model. One of them is a password field and the other
ssn#.

I have crypted_password and crypted_ssn in the db.
In addition, I also have validates_uniqueness_of :ssn

Here is the problem… I get the error
MysqlError: Unknown column ‘ssn’ in ‘where clause’: SELECT * FROM
students WHERE (ssn = ‘123-45-6789’) LIMIT 1

THe stack trace shows that…
…/active_record/connection_adapters/abstract_adapter.rb:88:in log' .../active_record/connection_adapters/mysql_adapter.rb:180:inexecute’
…/active_record/connection_adapters/mysql_adapter.rb:322:in select' .../active_record/connection_adapters/mysql_adapter.rb:171:inselect_all’
…/active_record/base.rb:431:in find_by_sql' .../active_record/base.rb:395:infind’
…/activerecord-1.13.2/lib/active_record/base.rb:393:in find' .../activerecord-1.13.2/lib/active_record/validations.rb:502:invalidates_uniqueness_of’

THe before_validation code in sentry is not substituting crypted_ssn
for ssn and also is not providing the encrypted value to the
validation code so that the table can be searched for uniqueness.

Can some one (please Rick :slight_smile: shed some light on this for me? THank you
very much.

-bakki