Ruby Datamapper оставил внешние соединения - PullRequest
4 голосов
/ 07 декабря 2011

Есть ли способ сделать левые внешние соединения в Datamapper без необходимости обращаться к хранилищу данных напрямую Я искал в сети и документ Datamapper безуспешно на деталях, как это сделать.

1 Ответ

0 голосов
/ 22 апреля 2015

Кажется, что строгие левые внешние соединения довольно сложны.

Просмотр сайта:

68 # QueryPaths can be used to construct joins in a very declarative manner.
69 #
70 # Starting from a root model, you can call any relationship by its name.
71 # The returned object again responds to all property and relationship names
72 # that are defined in the relationship's target model.
73 #
74 # This means that you can walk the chain of available relationships, and       then
75 # match against a property at the end of that chain. The object returned by
76 # the last call to a property name also responds to all the comparison
77 # operators available in traditional queries. This makes for some powerful
78 # join construction!
79 #
80 Customer.all(Customer.orders.order_lines.item.sku.like => "%BLUE%")

Глядя на документы , похоже, что класс Query имеет обработчик отношений, который знает о внешних ключах.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...