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

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.
512aa9434cec41da1cae7881a49618d6?d=identicon&s=25 Denise Eatherly (eatherly)
on 2006-03-16 21:07
(Received via mailing list)
Hi,

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
possibility.)

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.

Thanks,
Denise
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-16 22:06
(Received via mailing list)
This topic is locked and can not be replied to.