Skip to content

Commit ce3084e

Browse files
committed
Add tracking of join options for jsonapi-authorization gem
1 parent 978f590 commit ce3084e

File tree

2 files changed

+70
-50
lines changed

2 files changed

+70
-50
lines changed

lib/jsonapi/active_relation/join_manager.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,15 @@ def perform_joins(records, options)
147147
related_resource_klass = join_details[:related_resource_klass]
148148
join_type = relationship_details[:join_type]
149149

150+
join_options = {
151+
relationship: relationship,
152+
relationship_details: relationship_details,
153+
related_resource_klass: related_resource_klass,
154+
}
155+
150156
if relationship == :root
151157
unless source_relationship
152-
add_join_details('', {alias: resource_klass._table_name, join_type: :root})
158+
add_join_details('', {alias: resource_klass._table_name, join_type: :root, join_options: join_options})
153159
end
154160
next
155161
end
@@ -163,7 +169,7 @@ def perform_joins(records, options)
163169
options: options)
164170
}
165171

166-
details = {alias: self.class.alias_from_arel_node(join_node), join_type: join_type}
172+
details = {alias: self.class.alias_from_arel_node(join_node), join_type: join_type, join_options: join_options}
167173

168174
if relationship == source_relationship
169175
if relationship.polymorphic? && relationship.belongs_to?

0 commit comments

Comments
 (0)