Complex Database Associations

Hi All,

I’m running into some issues with a fairly complex database structure.

I have 4 tables:

  • id
  • name


  • id
  • product_id
  • name


  • id
  • product_id
  • serialnumber


  • id
  • productsitem_id
  • unit_id
  • partnumber
  • serialnumber

What I’m attempting to do is to create a page where, after selecting
which product I’m entering, I get presented with the data entry for a
new unit and the appropriate number of unitparts for that product as
defined by productsitems. The issue is that I need to somehow, in the
view, link the partnumber and serialnumber fields back to the
appropriate productsitem and then to parse them out so that those ids
make it into the database.

In other languages I would simply enumerate my fields and parse the
resulting variable names - is there a simple way to do this in Rails?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs