Re: HABTM and saving data

Duane Johnson
2005-06-15T14:16:42Z

On Jun 15, 2005, at 7:03 AM, Alex Ezell wrote:

> Hi, all! First-time poster, be gentle.

Did you see Doug Alcorn''s post about HABTM just a few minutes before
yours, or did you just subscribe to the list?

The basic idea for saving the association between two HABTM-assocated
tables is to:
1. Clear the association
2. Append all of the objects

Something like this:

     article.categories.clear
     article.categories <<
Category.find(@params[''category''])

The second line can deal with @params[''category''] as a single
id or
as an array of ids.

Duane Johnson
(canadaduane)




_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org