Editiing multiple has_many associations at once

I am search for a nice tidy solution to the following or if only to talk
the problem out aloud.

I have three tables

products
has_many :pricings
pricings
belongs_to :product
belongs_to :pricing_group
pricing_groups
had_many :pricings

I would like to have a single page where I can add/edit a product and on
the same page administer the pricing for that product for each pricing
group. e.g. Cost, Retail, Wholesale. Initially I thought this would be
fair easy but I have come unstuck.

Firstly I guess I need to list each of the PricingGroup with and input
box on in the product edit view, display the price if the product
already has a price for that group and if leaving the field empty. Then
when it comes to updating the product information simply adding a new
entry if one does not already exist for that group and then updating if
one already exists.

To be honest I have been battling with this won for a week and I’d
really like to see some examples of updating/adding multiple rows at
once. Anyone got any examples or be able to point me in the right
direction.

Many thanks.

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