If I have a Person model, and every person has a parent, that is in fact another person, can I still use the belongs_to and has_many methods?
A simple database migration might look like this
t.column :name, :string t.column :parent, :integer
So every person only has a name and some people have parents.
I have written some methods that find a person's parent and children:
class Person < ActiveRecord::Base def find_children Person.find_all_by_parent(self.id) end
def find_parent Person.find_by_id(self.parent) end end
These seem to work fine, but I was wondering if there was a neater way to do this?
Thanks,
DAZ