Has_and_belongs_to_many

My web server has a list of users, and each of them has a collection of
books. I want to save some certain number of books for each user,
including the book’s name, author, and display the information for the
user.

Which method should I use to store the subject information into each
user subject?
Do I have to create arrays to store it?

Thanks for help!

if every different user has his own distinct books use " belongs_to "
and "has_many " in the completing model. on the other hand, if every
user has a certain amount of books, and some of the books are used for a
different user, you should use “has_and_belongs_to_many” method.

(example would be like the following, if b are for books and user1/2/3
for different users…)

=====this would be has and belongs to many====
user 1 - - b1, b2, b3, b4
user 2 – b1, b6, b8
user 3 – b4, b5
etc

=====this would be belongs to ====

user 1 – b1 , b2
user 2 – b3, b4
user 3 – b5, b6, b7
etc

…hope this helps.
good luck,

s