The above - which is by far the most elegant way of putting it - doesn’t
work for me - the line_items don’t get saved. Presumably because the
order does not have an id yet, so they’re not linked up.
What is the best way to deal with such one-many associations when
creating new ones, other than first saving the order, then adding the
line_items and saving the order again?
On Sun, Jan 15, 2006 at 12:19:01PM +0100, Joerg D. wrote:
What is the best way to deal with such one-many associations when
creating new ones, other than first saving the order, then adding the
line_items and saving the order again?
What class/module is “build” in? Can’t find it anywhere in the rails
api…
b
Look at the description of has_many in the api. It adds several methods
to your collection, ‘build’ is one of them. For some reason it doesn’t
show up by itself in the API.
What class/module is “build” in? Can’t find it anywhere in the rails
api…
b
Look at the description of has_many in the api. It adds several methods
to your collection, ‘build’ is one of them. For some reason it doesn’t
show up by itself in the API.
RDoc is limited to documenting the static structure of a program - i.e.
the code that is there in the source files. Rails uses a combination of
adding methods to application classes at runtime, and interpreting
method calls on the fly using method_missing. Features that are
implemented in this way have to be documented in the narrative text for
a class, and can’t appear in the RDoc-generated method index.