Two foreign keys to the same table

Hi,

I’ve two tables:

ProductLists (id, name, …)
Product (id,name,product_list_1_id, product_list_2_id, …)

How can I map the fields product_list_1_id and product_list_2_id to the
ProductLists table in activerecord???

Thanks.

Matias wrote:

Hi,

I’ve two tables:

ProductLists (id, name, …)
Product (id,name,product_list_1_id, product_list_2_id, …)

How can I map the fields product_list_1_id and product_list_2_id to the
ProductLists table in activerecord???

Thanks.

class Product < blabla
belongs_to
:list1,:class_name=>“ProductList”,:foreign_key=>“product_list_1_id”
belongs_to
:list2,:class_name=>“ProductList”,:foreign_key=>“product_list_2_id”

end