Brian Mr wrote:
> Pål Bergström wrote:

> y = myrecord.myattribute
> 
> y now holds the unencypted value.

Got it working with this in the model:

before_save :crypt_data
after_save :decrypt_data
after_find :decrypt_data
define_method(:after_find) { }

Works perfect.

Just one more thing. How do I deal with search? I have a solution but 
perhaps I'm not doing it right.

I have a custom decrypt on the data before the find using %string% and 
LIKE, but it must be full words as the columns holds the encrypted data. 
Anyway around this?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to