I’m writing a module that has virtual attributes for some of my models. Now, i know why i get a stack too deep error and that i can use read_attribute with that.
However, i don’t really like the idea of having read_attribute methods inside my getters/setters. I think it makes the code a bit more unreadable. Is there another, prettier way to do that ?
If you’re looking for cleaner code, you can use
self[:attr]instead ofread/write_attribute(:attr):