read_attribute mystery

Paul Davidowitz wrote:

Project is a tree structure, with a ProjectRoot as the tree root.
User only knows about ProjectRoots. A (regular) Project asks its root
for the user. I understand what you are writing, but would still like
an answer regarding the infinite loop. Thanks
Because the user method is automatically generated by ActiveRecord::Base and overrides yours ?

If I'm right calling user on a child Project should return nil with your code. Assuming I'm right, you'd have to use a different name for your user method or your user_id column or define your user method after AR::B generates its methods. IIRC you can do it in after_initialize.