Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/jsonapi/authorization/authorizing_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def related_models
[:to_one, :to_many].flat_map do |rel_type|
data[rel_type].flat_map do |assoc_name, assoc_value|
case assoc_value
when nil
next
when Hash # polymorphic relationship
resource_class = @resource_klass.resource_for(assoc_value[:type].to_s)
resource_class.find_by_key(assoc_value[:id], context: context)._model
Expand All @@ -257,7 +259,7 @@ def related_models
primary_key = resource_class._primary_key
resource_class._model_class.where(primary_key => assoc_value)
end
end
end.compact
end
end

Expand Down