11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/decorators/para/component/crud_decorator.rb', line 11
def relation_path(controller_or_resource, *nested_resources, **options)
nested = nested_resources.any?
id_key = nested ? :resource_id : :id
if (id = (controller_or_resource))
options[id_key] = id
elsif Hash === controller_or_resource
options = controller_or_resource
end
route_key = route_key_for(options[id_key], options)
options[:model] = model_singular_route_key
data = [:admin, self, route_key].compact + nested_resources
options[:action] = action_option_for(options, nested: nested)
find_path(data, options)
end
|