Foreign key name in DataMapper associations?

And not for the first time, I have found the answer to my own question thanks to Jan De Poorter's very helpful blog entry It is necessary to adjust the conventions when dealing with field names so that it simply uses the name of the symbol rather than using it's built-in smarts regarding underscores repository(:default).adapter. Field_naming_convention = lambda { |value| value.name. To_s } The foreign key name can then be specified as follows: class Invoice # bla bla... has n, :items, :child_key => :invoiceId end class Item # bla bla... belongs_to :invoice, :child_key => :invoiceId end It is worth noting (as shown above) that the key name needs to be specified on both sides of the relationship (which I find a little bit strange, but hey).

Hopefully this will help anyone else who finds themselves asking the same question. Thanks to Jan De Poorter for the answer.

And not for the first time, I have found the answer to my own question thanks to Jan De Poorter's very helpful blog entry. It is necessary to adjust the conventions when dealing with field names so that it simply uses the name of the symbol rather than using it's built-in smarts regarding underscores. Repository(:default).adapter.

Field_naming_convention = lambda { |value| value.name. To_s } The foreign key name can then be specified as follows: class Invoice # bla bla... has n, :items, :child_key => :invoiceId end class Item # bla bla... belongs_to :invoice, :child_key => :invoiceId end It is worth noting (as shown above) that the key name needs to be specified on both sides of the relationship (which I find a little bit strange, but hey). Hopefully this will help anyone else who finds themselves asking the same question.

Thanks to Jan De Poorter for the answer.

Able to provide "better" names for use in our domain models. But if you instead call . Subset of the association's query results.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions