Skip to main content

Architecture Question - Connecting google books API and voting on favorite book

Rails • Asked by Joel Tennant

Hey guys,

I am using the Google books API to pull books and show them on my site. This is working great. However, I want to be able to allow users to favorite books they want to remember and also upvote or downvote books. Normally this would be easy. But the problem is that the books are not in my database, they come from calls to the API.

The problem is, how do I link favorites or votes to a book if books onl come from the api? So I thought that I could implement a function in voting and favoriting that first checks to see if the book is in my database, if it isn't then it adds it immediately then adds the persons vote. This would allow me to only put books in the DB when someone does the first vote or first favorite. However, how do I implement that and is that the best course to take?

Thank you,


I would like to know how to do this as well. I would think that you can just take the data that is returned and run a create method on it to store it into the database. However, some kind of table should exists for that data.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.