Module: Lucifer::InstanceMethods
- Defined in:
- lib/lucifer.rb
Instance Method Summary (collapse)
-
- (Object) after_find
Have to call it like this for performance reasons api.rubyonrails.org/classes/ActiveRecord/Callbacks.html.
- - (Object) decrypt_columns
- - (Object) encrypt_columns
-
- (Object) missing_attribute(attr_name, stack)
Starting with Rails 2.3.3, this ActiveRecord exception was being raised on certain associations related to a model with encrypt_attributes.
Instance Method Details
- (Object) after_find
Have to call it like this for performance reasons api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
57 58 59 |
# File 'lib/lucifer.rb', line 57 def after_find decrypt_columns end |
- (Object) decrypt_columns
61 62 63 64 65 |
# File 'lib/lucifer.rb', line 61 def decrypt_columns self.class.encrypted_columns.each do |col| send "#{col.chomp self.class.suffix}=", self.class.key_decrypt(eval(col)) end end |
- (Object) encrypt_columns
39 40 41 42 43 |
# File 'lib/lucifer.rb', line 39 def encrypt_columns self.class.decrypted_columns.each do |col| send "#{col}#{self.class.suffix}=", self.class.key_encrypt(eval(col)) end end |
- (Object) missing_attribute(attr_name, stack)
Starting with Rails 2.3.3, this ActiveRecord exception was being raised on certain associations related to a model with encrypt_attributes. As a patch, only raise the exception if the method really doesn't exist Warning: this method is designed to protect against uses of ActiveRecord#find with the :select option, so be careful
50 51 52 53 |
# File 'lib/lucifer.rb', line 50 def missing_attribute(attr_name, stack) return nil if respond_to?(attr_name) raise ActiveRecord::MissingAttributeError, "missing attribute: #{attr_name}", stack end |