Bala P. wrote:
How does your screen look like? I really don’t understand what you are
saying. Can you explain clearly without making any assumption what you
trying to do?
Sure, sorry i appreciate its a little confussing.
I have a currencies table in the database, which could hold multiple
rows for different currencys.
I also have a products table, which details information about products
on the system etc etc. Now, one product will have many prices based on
the currency - so its effectivly a HABTM, but ive changed it to has_many
:through as i heard it was more flexiable.
so basicly, the table structure is this: products HABTM currencies, and
the join table is product_prices. My models look like this:
class Currency < ActiveRecord::Base
has_many :products, :through => :product_prices
class Product < ActiveRecord::Base
has_many :currencies, :through => :product_prices
class ProductPrices < ActiveRecord::Base
So thus, im building an administration where when the client wants to
add a new product, they fill in the details, and say that the currencies
table has two rows, one for euro, and one for sterling, the add product
screen would present two text feilds needing both an inputed price for
sterling for that product and one for euro.
So you see, when i pass the post back to my controller, how do i handle
having two (or more, based on wats in the currencies table) rows to
insert into the product_prices table?
Hope that a good explanation of it