Creating new HaBtM?

Ok, I must be lame. Can’t figure out how to create a new entry in my
HABTM models. I just want to add a new book with two authors… How do
I do it?

class Author < ActiveRecord::Base
has_and_belongs_to_many :books
end

class Books < ActiveRecord::Base
has_and_belongs_to_many :authors
end

On 2 Dec 2007, at 13:03, yachtman wrote:

has_and_belongs_to_many :authors
end

Your Books model should be called Book.
Once that’s ok it’s as easy as book.authors = [author_1, author_2]

Fred