Hi,

I'm noted with Rails that if one assigns one object (say Book "b") to
another object (say Chapter "c") that the call "b.chapters" doesn't work.

Question: Is there a way to ensures associations work both ways at the
object level (i.e. prior to any DB saves)?  (i.e. so in the above cases
after I allocate a Book against a Chapter (e.g. c.book = b), that
"b.chapters" should then work?

Overall example:
  b = Book.new
  c = Chapter.new
  c.book = b
  c.book ==> works and gives b object
  b.chapters ==> DOES NOT WORK - gives []

Also:
  b = Book.new
  c = Chapter.new
  b.chapters = [c]
  b.chapters ==> works
  c.book ==> DOES NOT WORK

Notes:
* This is a specific question I have (relates to what I'm trying to achieve
is a separate post "Validation spanning multiple models(tables) - how can
this "):

Thanks in advance

-- 
Greg
http://blog.gregnet.org/

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