Displaying 1 result from an estimated 1 matches for "books_users".
2006 Dec 25
2
how to insert data using has_and_belongs_to_many
I''am newbie in RoR, so my question might look stupid, but I stuck in one
thing.
I''ve created 3 tables:
users{
id,
user
}
books
{
id,
book
}
books_users{
book_id,
user_id}
Model
class Book< ActiveRecord::Base
has_and_belongs_to_many:users
I can''t figure out how to insert data to the books_users table.
For example users post info about new book and information should be
stored in the tables books and books_users.
>>@book = Book...