search for: belongs_to_many

Displaying 3 results from an estimated 3 matches for "belongs_to_many".

2006 Jul 05
1
newbie question: Mapping Collections
...mns, a Recipe index and Ingredient index. I could then write some simple SQL to pull all the Ingredients for my Recipe or to get all the Recipes containing a specific Ingredient. It doesn''t look like this is how it happens in rails. Do I modify my Ingredient class to have a ''belongs_to_many'' relationship to Recipe and Recipe to have a ''has_many'' relationship to Ingredients? How is this mapping done on the DB? What fields in the tables do I need to add? Am I able to easily query the stuff mentioned above? Thanks in advance, Noah -------------- next p...
2006 Jun 18
2
Table Relationship for Select option list
...e mfg_model. This is a one-way relationship, where the value of device.mfg_model_id simply refers to a list of static attributes and saves space in my device table. Is this right? I''ve let myself get confused because every code example I''ve found shows a corresponding "belongs_to_many" relationship pointing in the other direction. Do I need one in this case? Thanks! -Mason -- Posted via http://www.ruby-forum.com/.
2006 Oct 06
4
HABTM question
While the habtm model for rails is very easy to use, some tables don''t seem to fit easily into that structure. The problem is that the link is (I believe) always done on the id column. One common table in a lot of databases is a state codes table with one column for state code, another for state name, and possibly others for different things about the state. Other tables that have