Thanks very much for your reply. I now understand it has to be a one-
to-many relation. Also you are right about the name. It caused me much
confusion and I have changed it to something that pluralizes much
better.

On Jan 8, 12:15 pm, Colin Law <[email protected]> wrote:
> On 7 January 2012 21:12, davidwright66 <[email protected]> wrote:
>
> > Hi,
>
> > I am creating a stock control application.
> > I have a table called "equipment_type" that stores a general
> > description of a piece of equipment. This could be for instance: Canon
> > 60D DSLR camera.
> > I also have an table called "equipment" that stores all the equipment
> > we have with their serial numbers. There may bemanyCanon 60Ds and
> > they should refer to the "equipment_type" table for their description.
> > Is this aone-to-oneassociation, because they have onlyone
> > description.
> > Or is this aone-to-many, becauseone"equipment_type" is related to
> >many"equipment"
>
> If it wereonetoonethen there could only beoneequipment object
> for each type, that is whatonetoonemeans.  Have a look at the
> Rails Guide on ActiveRecord Associations for a good introduction to
> the association types.
>
> I would avoid the use of the word equipment for the table name.  It
> does not read well.  Normally the table name should be the plural of
> the objects in the table.  equipment_item might be better, then you
> can haveoneequipment items or two equipment_items.
>
> Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to