Skip to content

Commit ee1c8b1

Browse files
Apply safe navigation when resolving optional belongs_to resource (#309)
# Bug fix ## Description Handle resolving a dangling (`optional: true`) belongs_to inverse association gracefully
1 parent 177fcef commit ee1c8b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/concerns/cable_ready/updatable/collections_registry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def find_resource_for_update(collection, model)
5252

5353
resource = model
5454
resource = resource.send(collection.through_association.underscore) if collection.through_association
55-
resource.send(collection.inverse_association.underscore)
55+
resource&.send(collection.inverse_association.underscore)
5656
end
5757
end
5858
end

0 commit comments

Comments
 (0)