Forum: Ruby on Rails Saving habtm relationships and Rails 1.0

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jennyw J. (Guest)
on 2006-01-12 20:44
(Received via mailing list)
I know there's a problem saving has_and_belongs_to_many relationships w/
Rails 1.0 in that only the first association is saved

What are people doing about this? I guess I could move to using the
trunk release, but I'm hesitant because that might introduce a bunch of

Is there a workaround?  For example, a way to explicitly saves


Sean H. (Guest)
on 2006-01-30 20:20
(Received via mailing list)
I've been saving the associated object whenever I add something.  This
is terribly inefficient, but I haven't found a consensus on the
"right" way to do it.

# Set up the staff object, and then...
default_entitlements = %w(this that the_other_thing)
default_entitlements.each { |e|
  staff.entitlements << Entitlement.find_by_code(e)

Not great, but it works.
This topic is locked and can not be replied to.