That Works! Thanks!

2009/6/7 Marnen Laibow-Koser <[email protected]>

>
> 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 :children
> end
>
> class Child > ActiveRecord::Base
>  belongs_to :parent
> end
>
> ...and parent.children and child.parent will work as you'd like.
> @connector is unnecessary.
>
> Check the docs for Associations; Rails makes this ridiculously simple.
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
cashflowclublondon.co.uk

                      ("`-''-/").___..--''"`-._
                       `6_ 6  )   `-.  (     ).`-.__.`)
                       (_Y_.)'  ._   )  `._ `. ``-..-'
                     _..`--'_..-_/  /--'_.' ,'
                    (il),-''  (li),'  ((!.-'
.

--~--~---------~--~----~------------~-------~--~----~
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