Hello, I have a simple question based around the following example:
I have two model classes: Book and Author. The books table in my database has an author_id, which links the book to the appropriate author (aside: I know this isn't the best way to implement this, seeing that a book can have multiple authors, but I'm trying to keep it simple for the example and my own learning ;-)).
Now, I have my show.rhtml file for my Book class, where I want to display all of the pertinent info: book title, date published, and, most importantly to this example, the author's name.
My question is: given the book's author_id, what is the preferred/recommended way to grab the auther's information from the database from my book's show page?
Do I need to add a method to my Author class which, when provided with the unique author_id, will return the necessary information?