Fix user parent/child self join relationship
Refactor main behavior to work in Rails 3