[Rails] Re: How to access parent property

2009-06-07 Thread Developer In London
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

[Rails] Re: How to access parent property

2009-06-07 Thread 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. All you need is class Parent > ActiveRecord::Base has_many :chil

[Rails] Re: How to access parent property

2009-06-07 Thread Developer In London
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: >

[Rails] Re: How to access parent property

2009-06-07 Thread Conrad Taylor
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