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
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M000473
--
Posted via http://www.ruby-forum.com/.