8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/prato/internal/sql_support.rb', line 8
def table_for(scope, association_path)
return scope.model.arel_table if association_path.empty?
expanded = expand_through_associations(scope.model, association_path)
join_sources = scope.arel.join_sources
table = walk_join_path(scope.model, scope.model.arel_table, expanded, join_sources)
unless table
raise ArgumentError,
"Unable to resolve table alias for association path #{association_path.inspect}"
end
table
end
|