aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-09-03 19:02:31 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-09-03 19:02:31 +0900
commita0aea912e4bd8932ec1d833b0a718d9192356083 (patch)
tree6c04a804a8e73263d25208edac095fce58f70214 /activerecord
parentf2f00ca54a83e86ef845ec9fb3e9e373d367550f (diff)
downloadrails-a0aea912e4bd8932ec1d833b0a718d9192356083.tar.gz
rails-a0aea912e4bd8932ec1d833b0a718d9192356083.tar.bz2
rails-a0aea912e4bd8932ec1d833b0a718d9192356083.zip
Pass `set_inverse_instance` block to `sc.execute` for `SingularAssociation`
Follow up to caa178c. caa178c updated all code which sets inverse instances on newly loaded associations to use block. But `SingularAssociation` was forgotten it.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/singular_association.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb
index 1fe9a23263..5445ca34a8 100644
--- a/activerecord/lib/active_record/associations/singular_association.rb
+++ b/activerecord/lib/active_record/associations/singular_association.rb
@@ -56,9 +56,9 @@ module ActiveRecord
end
binds = AssociationScope.get_bind_values(owner, reflection.chain)
- if record = sc.execute(binds, klass, conn).first
+ sc.execute(binds, klass, conn) do |record|
set_inverse_instance record
- end
+ end.first
end
def replace(record)