Skip to content

Commit 1bfc30a

Browse files
authored
simplify has_one adapter logic (#85)
1 parent 39ee06c commit 1bfc30a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/jsonapi_compliable/adapters/active_record_sideloading.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def has_one(association_name, scope: nil, resource:, foreign_key:, primary_key:
5858
parent.association(association_name).loaded!
5959
relevant_child = children.find { |c| c.send(foreign_key) == parent.send(primary_key) }
6060
next unless relevant_child
61-
parent.association(association_name).replace(relevant_child, false)
61+
parent.send(:"#{association_name}=", relevant_child)
6262
end
6363
end
6464

lib/jsonapi_compliable/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module JsonapiCompliable
2-
VERSION = "0.11.10"
2+
VERSION = "0.11.11"
33
end

0 commit comments

Comments
 (0)