Sounds like a many to many relationship, in which case you need to
declare has_and_belongs_to_many on both people and children. The
relationship then works through a join table. If you did this, you'd
need to re think your model a little and your find and add problems
would be different.
Martin

On Jan 26, 9:18 am, James Bond <[email protected]>
wrote:
> I have 2 tables:
>
> people (id, name)
> children (id, parents_id, child_id)
>
> parents_id = people.id and child_id = people_id also
>
> So how I make a relationships in Rails?
>
> And how can all search:
>
> Children.find(:all, :conditions => ["parents.name LIKE 'Clin%' ???? Or
> how???
>
> And what if I want to add new child. Parents name is in people table,
> but childs not, so how I do?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to