If I am building a book store. How do I store Author information in the DB for a book (using rails) ? What if there are multiple Authors for a book.

I am thinking of storing it as comma separated string values which is also a string. Is there a better approach ?

Posted over 4 years ago by Deepak
Posted over 4 years ago by Alex Yang

I would create a separate database to store the Author information. Each line in the database would remember one Author name and the ID of the book they wrote (so a book with 5 authors would need 5 lines). This approach will allow you to keep track of as many authors you like, and the book_id column will allow you to link this database with your Book database. Does this make sense?

1