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 be many Canon 60Ds and
> they should refer to the "equipment_type" table for their description.
> Is this a one-to-one association, because they have only one
> description.
> Or is this a one-to-many, because one "equipment_type" is related to
> many "equipment"

If it were one to one then there could only be one equipment object
for each type, that is what one to one means.  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 have one equipment 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