We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the simplest case, imagine 2 jobs or requests are updating different fields of the same document.
:a
as_json
:b
Or, in a console:
j1 = User.find_by_email('[email protected]') # => #<User ...> j2 = User.find_by_email('[email protected]') # => #<User ...> j1.phone # => "646-338-3382" j1.as_json(properties: :all)[:phone] # => "646-338-3382" j2.phone # => "646-338-3382" j2.phone = '800-foo-barz' # => "800-foo-barz" j2.save! # => true j2.as_json(properties: :all)[:phone] # => "800-foo-barz" j1.profession = 'chimney sweep' # => "chimney sweep" j1.save! # => true j1.as_json(properties: :all)[:phone] # => "646-338-3382" User.find_by_email('[email protected]').as_json(properties: :all)[:phone] # => "646-338-3382" User.find_by_email('[email protected]').phone # => "800-foo-barz"
The text was updated successfully, but these errors were encountered:
Is the core issue here that as_json is meant to be a read method, but it also mutates shared state and can't be done atomically?
Sorry, something went wrong.
No branches or pull requests
In the simplest case, imagine 2 jobs or requests are updating different fields of the same document.
:a
and callsas_json
(at this point, the cache is accurate):b
and callsas_json
(at this point, a stale value of:a
replaced the accurate value)Or, in a console:
The text was updated successfully, but these errors were encountered: