hi..
I have separated a product table and a price table,
because One product can have many prices.
Users choose a bag_size  from the drop down box.

ex) a prodct "a" has 2 bag size(1,2)
     a price of 1 is $4.99
     a price of 2 is $5.99

ex) a product "b" has 3 bag size(1, 2, 3)
     a price of 1 is $3.99
     a price of 2 is $4.99
     a price of 3 is $5.99

now I'd like to show a list of products with prices of each.

index(store)
=========
<%= collection_select "bagList", :price,
@prices, :price, :bag_size, :prompt =>"Bag Size"  %>

controller(store)
===========
@prices = Price.find(:all)

model(price)
============
belongs_to :product, :foreign_key => :product_id

model(product)
===========
has_many :prices, :dependent => :destroy

the above code shows all the prices on the price list...

||product "a" || product "b"||
||price 1,2,1,2,3||price 1,2,1,2,3||

well, i'd like to show products and a drop down select list with their
own prices..
||product "a" || product "b"||
||price 1,2||price 1,2,3||

anyone can help me out, pls?




--~--~---------~--~----~------------~-------~--~----~
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