Bitmaker Labs – Day 15

After yesterday’s SQL learning, today we’re back to RoR and using queries in our assignment. For our assignment for the next few days, we’ll be building an Amazon clone.

Our task is to build a site that:

  • Has products
  • Can have users sign up
  • Users are able to post reviews
  • Users can sign in and out

That’s the simple stuff. The more complex things we need to do are designing it all, adding query functions, and much more. I have a basic working version right now, and hopefully I can work on it more and make it better later on. Right now I’m busy trying to understand how to build the application and all the associations with it. Specifically, trying to learn associations, which is today’s lecture.

Associations work like this:

class Product < ActiveRecord::Base
     has_many :reviews
     has_many :users, :through => :reviews

You’re basically telling the database to associate all these fields together, so that you are then able to query them and present them together. Anyways, that’s it for now. Hooray weekend.

Leave a Comment

Your email address will not be published. Required fields are marked *