Forum: Ruby on Rails [Sentry]-before_validation(model) not working for crypted-at

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bakki K. (Guest)
on 2006-03-25 03:41
(Received via mailing list)
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:in `execute'
.../active_record/connection_adapters/mysql_adapter.rb:322:in `select'
.../active_record/connection_adapters/mysql_adapter.rb:171:in
`select_all'
.../active_record/base.rb:431:in `find_by_sql'
.../active_record/base.rb:395:in `find'
.../activerecord-1.13.2/lib/active_record/base.rb:393:in `find'
.../activerecord-1.13.2/lib/active_record/validations.rb:502:in
`validates_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 :) shed some light on this for me? THank you
very much.

-bakki
This topic is locked and can not be replied to.