Ask A Question


You’re not receiving notifications from this thread.

What type of association should I choose...I'm lost in the woods.

Charles Smith asked in Rails

I cannot for the life of me figure out the best model association to choose and I've thought myself into a corner. I'm building a site for a client that offers party services for four(4) locations in Southern California.

For this, I have three(3) models - Locations, Categories, Products.

Here are some URL examples:

The products model will have 4 price columns and the price on the page will be determined by the /location-url/ and will be displayed with jQuery. Other than that all the models are shared with the only caveate is that a Product has to belong to a category and location, but I want to be able to share the Product and Category models with many locations so I don't have to create a duplicate for each location. I hope I am making some sense. Thank you.


Product and Category need to have many locations probably using a through association.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,969+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.