-
Notifications
You must be signed in to change notification settings - Fork 36
BufferedMutation breaks after_xxx hooks. #177
Copy link
Copy link
Open
Labels
api: spannerIssues related to the googleapis/ruby-spanner-activerecord API.Issues related to the googleapis/ruby-spanner-activerecord API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the googleapis/ruby-spanner-activerecord API.Issues related to the googleapis/ruby-spanner-activerecord API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
activerecord-spanner-adapter breaks ActiveRecord's after_xxx hooks.
Perhaps this is a problem caused by BufferedMutation.
Like codes shows in bellow, I am unable to retrieve the record in the
after_saveblock immediately after insertion.I doubt that this similar problem is also happening in
after_updateandafter_create.Solution(?)
I do not have a idea to monkey-patch for this problem.
My only solution was to remove
require "activerecord_spanner_adapter/base"from lib.ruby-spanner-activerecord/lib/active_record/connection_adapters/spanner_adapter.rb
Line 23 in 07f5b6c
Reproduce
sample code:
output:
This is expected output by using MySQL or remove
require "activerecord_spanner_adapter/base"from lib.