6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/adjustable_schema/active_record/builder.rb', line 6
def relationship! *models, roles: [], **mapping
return relationship!({ **Hash[*models], **mapping }, roles:) if
mapping.any?
case models
in [
String | Symbol | Class => source,
String | Symbol | Class => target,
]
define_relationship source, target,
roles:
in [ Hash => models ]
define_relationships models,
roles:
in [ String | Symbol | Class => model ]
define_recursive_relationship model,
roles:
end
end
|