aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-09-08 20:28:22 +0200
committerGitHub <noreply@github.com>2016-09-08 20:28:22 +0200
commitcf5f55cd30aef0f90300c7c8f333060fe258cd8a (patch)
treecb096abf29feea237a2028e9b3acf1adc421cbb6
parent087427e0d1f7baf804ae52e13dc55bfa78a50123 (diff)
parenta0aea912e4bd8932ec1d833b0a718d9192356083 (diff)
downloadrails-cf5f55cd30aef0f90300c7c8f333060fe258cd8a.tar.gz
rails-cf5f55cd30aef0f90300c7c8f333060fe258cd8a.tar.bz2
rails-cf5f55cd30aef0f90300c7c8f333060fe258cd8a.zip
Merge pull request #26380 from kamipo/pass_set_inverse_instance_block
Pass `set_inverse_instance` block to `sc.execute` for `SingularAssociation`
-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 483a9df740..e386cc0e4c 100644
--- a/activerecord/lib/active_record/associations/singular_association.rb
+++ b/activerecord/lib/active_record/associations/singular_association.rb
@@ -48,9 +48,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)