That Works! Thanks!
2009/6/7 Marnen Laibow-Koser
>
> developerinlondon wrote:
> > Hi,
> >
> > I am having difficulties accessing parent properties/attributes from
> > the child. Anyone could shed some lights onto this?
> >
> > Heres a sample code:
> [...]
>
> Your sample code will not do the job
developerinlondon wrote:
> Hi,
>
> I am having difficulties accessing parent properties/attributes from
> the child. Anyone could shed some lights onto this?
>
> Heres a sample code:
[...]
Your sample code will not do the job. All you need is
class Parent > ActiveRecord::Base
has_many :chil
No I need to have it so that Child has one parent.
I managed to get a reference to the parent by using the ObjectSpace. But its
almost a hack then a nice way of doing it.
2009/6/7 Conrad Taylor
>
> Hi, when I saw your models, I was thinking that you should have the
> following relationships:
>
Hi, when I saw your models, I was thinking that you should have the
following relationships:
Parent has many children
Child has many parents
Thus, you should have the following database tables: children and
parents. By doing this, this becomes a many to many relationship.
Good luck,
-Co
4 matches
Mail list logo