If I make something like this:
class ActiveRecord::Base
def self.encrypt(*attr_names)
encrypter = Encrypter.new(attr_names)
before_save encrypter
after_save encrypter
after_find encrypter
define_method(:after_find) { }
end
end
- Where do I have to save this file?
- Do it need to have a special name?
- Do I have to call
requiresomewhere? - Could I save it in the model folder?
- Is a class declared in the model folder visible from the other classes in the model folder without calling
require?