Skip to content

Commit 117c8f5

Browse files
committed
Merge branch 'master' into framework-ui
2 parents 9e77c2c + 37fd856 commit 117c8f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/active_scaffold/constraints.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def apply_constraint_on_association(record, association, value, allow_autosave:
164164
apply_constraint_on_polymorphic_association(record, association, value)
165165
elsif !association.source_reflection&.through? && # regular singular association, or one-level through association
166166
!value.is_a?(Array)
167-
record.send(:"#{k}=", association.klass.find(value))
167+
record.send(:"#{association.name}=", association.klass.find(value))
168168

169169
# setting the belongs_to side of a has_one isn't safe. if the has_one was already
170170
# specified, rails won't automatically clear out the previous associated record.
@@ -173,7 +173,7 @@ def apply_constraint_on_association(record, association, value, allow_autosave:
173173
# run operations where activerecord auto-saves the object.
174174
reverse = association.reverse_association
175175
if reverse&.singular? && !reverse.belongs_to? && allow_autosave
176-
record.send(k).send(:"#{reverse.name}=", record)
176+
record.send(association.name).send(:"#{reverse.name}=", record)
177177
end
178178
end
179179
end

0 commit comments

Comments
 (0)