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.
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs