Forum: Ruby on Rails sql functions in cru ( not d )

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Denise E. (Guest)
on 2006-03-16 22:07
(Received via mailing list)

I'm looking at ways to encrypt email addresses rather than storing
them directly in the database.

There are several ways that it could be done.  I could make an
Encrypter class and use before_update, etc.  Or I could set up an
updatable VIEW in mySql.  (I guess triggers might be another

However, what I would really LIKE to do is use the handy AES_ENCRYPT
and AES_DECRYPT functions in mySql.  If I were doing this with
straight sql, I would just use
	 INSERT INTO myTable VALUES( null, 'user name', AES_ENCRYPT
('user_email' , 'password' ).

Since ActiveRecord handles all this for me, it is not clear if I can
override the insert, update and select statements for a table.  It
may not be a very good idea, but I'd like more information before
giving up on it.

Emin H. (Guest)
on 2006-03-16 23:06
(Received via mailing list)
This topic is locked and can not be replied to.