List Info

Thread: Editiing multiple has_many associations at once




Editiing multiple has_many associations at once
user name
2006-08-17 16:38:18
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.

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )