Skip to content

Instantly share code, notes, and snippets.

@klochner
Created February 5, 2010 00:31
class Foo < ActiveRecord::Base
has_and_belongs_to_many :bars
end
class Bar < ActiveRecord::Base
has_and_belongs_to_many :foos
end
@foo = Foo.create
@bars = Bar.find_all_by_some_attribute(:a)
@foo.bars = @bars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment