Re: [DataMapper] many-to-many in legacy db

2012-09-30 Thread Roman Dzvinkovsky
Thanks you! 2012/9/24 Zhi-Qiang Lei : > En taro Tassadar, > > You can write it in this way. > > class ContactFund > include DataMapper::Resource > > def self.default_repository_name > :vm_legacy > end > > storage_names[:vm_legacy] = 'contactfunds' > > belongs_to :fund > belongs_to

Re: [DataMapper] many-to-many in legacy db

2012-09-24 Thread Zhi-Qiang Lei
En taro Tassadar, You can write it in this way. class ContactFund include DataMapper::Resource def self.default_repository_name :vm_legacy end storage_names[:vm_legacy] = 'contactfunds' belongs_to :fund belongs_to :contact property :fund_id, String, key: true, field: "fundID

[DataMapper] many-to-many in legacy db

2012-09-23 Thread romand
En taro Tassadar, I use DM to access legacy db with many-to-many relationship between Fund and Contact models, through ContactFund -- table with 2 columns: 'fundID' and 'contactID'. Here is my model: http://pastebin.com/KtQcdRyq But child_key is ignored for some reason, so DM looks for 'fund_id