Skip to content

Fix conflicts counter_cache with touch: true by optimistic locking. - #31405

Merged
rafaelfranca merged 1 commit into
rails:masterfrom
bogdanvlviv:fix-conflicts-counter_cache-with-touch-by-optimistic_locking
Dec 12, 2017
Merged

rafaelfranca merged 1 commit into
rails:masterfrom
bogdanvlviv:fix-conflicts-counter_cache-with-touch-by-optimistic_locking

Conversation

@bogdanvlviv

Copy link
Copy Markdown
Contributor
# create_table :posts do |t|
#   t.integer :comments_count, default: 0
#   t.integer :lock_version
#   t.timestamps
# end
class Post < ApplicationRecord
end

# create_table :comments do |t|
#   t.belongs_to :post
# end
class Comment < ApplicationRecord
  belongs_to :post, touch: true, counter_cache: true
end

Before:

post = Post.create!
# => begin transaction
     INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
     VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
     commit transaction

comment = Comment.create!(post: post)
# => begin transaction
     INSERT INTO "comments" ("post_id") VALUES (1)

     UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
     "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1

     UPDATE "posts" SET "updated_at" = '2017-12-11 21:27:11.398330',
     "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
     rollback transaction
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.

Comment.take.destroy!
# => begin transaction
     DELETE FROM "comments" WHERE "comments"."id" = 1

     UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
     "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1

     UPDATE "posts" SET "updated_at" = '2017-12-11 21:42:47.785901',
     "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
     rollback transaction
# => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.

After:

post = Post.create!
# => begin transaction
     INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
     VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
     commit transaction

comment = Comment.create!(post: post)
# => begin transaction
     INSERT INTO "comments" ("post_id") VALUES (1)

     UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
     "lock_version" = COALESCE("lock_version", 0) + 1,
     "updated_at" = '2017-12-11 21:37:09.802642' WHERE "posts"."id" = 1
     commit transaction

comment.destroy!
# => begin transaction
     DELETE FROM "comments" WHERE "comments"."id" = 1

     UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
     "lock_version" = COALESCE("lock_version", 0) + 1,
     "updated_at" = '2017-12-11 21:39:02.685520' WHERE "posts"."id" = 1
     commit transaction

Fixes #31199.

@rails-bot

Copy link
Copy Markdown

r? @rafaelfranca

(@rails-bot has picked a reviewer for you, use r? to override)

  ```
  # create_table :posts do |t|
  #   t.integer :comments_count, default: 0
  #   t.integer :lock_version
  #   t.timestamps
  # end
  class Post < ApplicationRecord
  end

  # create_table :comments do |t|
  #   t.belongs_to :post
  # end
  class Comment < ApplicationRecord
    belongs_to :post, touch: true, counter_cache: true
  end
  ```

  Before:
  ```
  post = Post.create!
  # => begin transaction
       INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
       VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
       commit transaction

  comment = Comment.create!(post: post)
  # => begin transaction
       INSERT INTO "comments" ("post_id") VALUES (1)

       UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
       "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1

       UPDATE "posts" SET "updated_at" = '2017-12-11 21:27:11.398330',
       "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
       rollback transaction
  # => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.

  Comment.take.destroy!
  # => begin transaction
       DELETE FROM "comments" WHERE "comments"."id" = 1

       UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
       "lock_version" = COALESCE("lock_version", 0) + 1 WHERE "posts"."id" = 1

       UPDATE "posts" SET "updated_at" = '2017-12-11 21:42:47.785901',
       "lock_version" = 1 WHERE "posts"."id" = 1 AND "posts"."lock_version" = 0
       rollback transaction
  # => ActiveRecord::StaleObjectError: Attempted to touch a stale object: Post.
  ```

  After:
  ```
  post = Post.create!
  # => begin transaction
       INSERT INTO "posts" ("created_at", "updated_at", "lock_version")
       VALUES ("2017-12-11 21:27:11.387397", "2017-12-11 21:27:11.387397", 0)
       commit transaction

  comment = Comment.create!(post: post)
  # => begin transaction
       INSERT INTO "comments" ("post_id") VALUES (1)

       UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1,
       "lock_version" = COALESCE("lock_version", 0) + 1,
       "updated_at" = '2017-12-11 21:37:09.802642' WHERE "posts"."id" = 1
       commit transaction

  comment.destroy!
  # => begin transaction
       DELETE FROM "comments" WHERE "comments"."id" = 1

       UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) - 1,
       "lock_version" = COALESCE("lock_version", 0) + 1,
       "updated_at" = '2017-12-11 21:39:02.685520' WHERE "posts"."id" = 1
       commit transaction
  ```

  Fixes rails#31199.
@bogdanvlviv
bogdanvlviv force-pushed the fix-conflicts-counter_cache-with-touch-by-optimistic_locking branch from 67d57a6 to 6ddba9b Compare December 11, 2017 22:34
car = Car.create!

assert_difference "car.wheels.count" do
car.wheels << Wheel.create!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you need to change this test because this code is not valid anymore? Or it is because you added touch: true to the Wheel model?

@bogdanvlviv bogdanvlviv Dec 12, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it because I had added touch: true to the Wheel and after this code became invalid.

@rafaelfranca
rafaelfranca merged commit 185a30f into rails:master Dec 12, 2017
@bogdanvlviv
bogdanvlviv deleted the fix-conflicts-counter_cache-with-touch-by-optimistic_locking branch December 12, 2017 21:48
rafaelfranca added a commit that referenced this pull request Dec 12, 2017
…e-with-touch-by-optimistic_locking

Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
model.after_destroy callback.(:changes_to_save)
unless reflection.counter_cache_column
model.after_create callback.(:saved_changes), if: :saved_changes?
model.after_destroy callback.(:changes_to_save)

@jolim jolim Feb 26, 2018 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a change in behavior which I believe is associated with removing the after_destroy callback for items with counter caches.

In 5.1.4, models chained together with belongs_to and touch: true would change their updated_at timestamps regardless of the presence of a counter cache. Now, a model with a counter_cache won't propagate the touch past the next model.

Example:

class Books
    belongs_to :author, touch: true, counter_cache: true
end

class Author
  belongs_to :publisher, touch: true
end

In 5.1.4, when you destroy a Book, the Author and the Publisher both get new updated_at values.

In 5.1.5, only the Author is updated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran into this as well when migrating to 5.1.6.1. How was this not considered a breaking change?

@bogdanvlviv bogdanvlviv Feb 5, 2019 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try 5-1-stable branch (because 5.1.7 hasn't been released yet). I suppose it should be fixed there by 81dd13d, 4034a08?

bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Mar 18, 2018
- Remove
  ```
  *   Namespace error pages' CSS selectors to stop the styles from bleeding
      into other pages when using Turbolinks.
      ([Pull Request](rails#28814))
  ```
  since it was backported to
  `5-1-stable` by 50d5baf
  and
  `5-0-stable` by d1c4a39.

- Remove
  ```
  *   Allow irb options to be passed from `rails console` command.
      ([Pull Request](rails#29010))
  ```
  since it was backported to
  `5-1-stable` by e91b483.

- Remove
  ```
  *   Load environment file in `dbconsole` command.
      ([Pull Request](rails#29725))
  ```
  since it was backported to
  `5-1-stable` by 7f93428.

- Remove
  ```
  *   Gemfile for new apps: upgrade redis-rb from ~> 3.0 to 4.0.
      ([Pull Request](rails#30748))
  ```
  since it was backported to
  `5-1-stable` by 3789531.

- Remove
  ```
  *   Fix minitest rails plugin.
      The custom reporters are added only if needed.
      This will fix conflicts with others plugins.
      ([Commit](rails@ac99916))
  ```
  since it was backported to
  `5-1-stable` by caa7695.

- Remove
  ```
  *   Add support for compatibility with redis-rb gem for 4.0 version.
      ([Pull Request](rails#30748))
  ```
  since it was backported to
  `5-1-stable` by 3789531.

- Remove
  ```
  *   Add `action_controller_api` and `action_controller_base` load hooks to be
      called in `ActiveSupport.on_load`.
      ([Pull Request](rails#28402))
  ```
  since it was backported to
  `5-1-stable` by b9a5fd7.

- Remove
  ```
  *   `driven_by` now registers poltergeist and capybara-webkit.
      ([Pull Request](rails#29315))
  ```
  since it was backported to
  `5-1-stable` by c5dd451.

- Remove
  ```
  *   Fallback `ActionController::Parameters#to_s` to `Hash#to_s`.
      ([Pull Request](rails#29630))
  ```
  since it was backported to
  `5-1-stable` by c1014e4
  and
  `5-0-stable` by 0e71fc3.

- Remove
  ```
  *   Make `take_failed_screenshot` work within engine.
      ([Pull Request](rails#30421))
  ```
  since it was backported to
  `5-1-stable` by 595a231.

- Remove
  ```
  *   Fix optimized url helpers when using relative url root.
      ([Pull Request](rails#31261))
  ```
  since it was backported to
  `5-1-stable` by e9b7795.

- Remove
  ```
  *   Update `distance_of_time_in_words` helper to display better error messages
      for bad input.
      ([Pull Request](rails#20701))
  ```
  since it was backported to
  `5-1-stable` by 2c97fbf.

- Remove
  ```
  *   Generate field ids in `collection_check_boxes` and
      `collection_radio_buttons`.
      ([Pull Request](rails#29412))
  ```
  since it was backported to
  `5-1-stable` by 2d8c10a.

- Remove
  ```
  *   Fix issues with scopes and engine on `current_page?` method.
      ([Pull Request](rails#29503))
  ```
  since it was backported to
  `5-1-stable` by 2135daf.

- Remove
  ```
  *   Bring back proc with arity of 1 in `ActionMailer::Base.default` proc
      since it was supported in Rails 5.0 but not deprecated.
      ([Pull Request](rails#30391))
  ```
  since it was backported to
  `5-1-stable` by b2bedb1.

- Remove
  ```
  *   Add type caster to `RuntimeReflection#alias_name`.
      ([Pull Request](rails#28961))
  ```
  since it was backported to
  `5-1-stable` by f644e7a.

- Remove
  ```
  *   Loading model schema from database is now thread-safe.
      ([Pull Request](rails#29216))
  ```
  since it was backported to
  `5-1-stable` by 02926cf.
  and
  `5-0-stable` by 84bcfe5

- Remove
  ```
  *   Fix destroying existing object does not work well when optimistic locking
      enabled and `locking_column` is null in the database.
      ([Pull Request](rails#28926))
  ```
  since it was backported to
  `5-1-stable` by e498052.

- Remove
  ```
  *   `ActiveRecord::Persistence#touch` does not work well
      when optimistic locking enabled and `locking_column`,
      without default value, is null in the database.
      ([Pull Request](rails#28914))
  ```
  since it was backported to
  `5-1-stable` by 1e2f63d.

- Remove
  ```
  *   Previously, when building records using a `has_many :through` association,
      if the child records were deleted before the parent was saved,
      they would still be persisted. Now, if child records are deleted
      before the parent is saved on a `has_many :through` association,
      the child records will not be persisted.
      ([Pull Request](rails#29593))
  ```
  since it was backported to
  `5-1-stable` by a22c39e.

- Remove
  ```
  *   Query cache was unavailable when entering the `ActiveRecord::Base.cache`
      block without being connected.
      ([Pull Request](rails#29609))
  ```
  since it was backported to
  `5-1-stable` by fd6c8cd
  and
  `5-0-stable` by 9f2532b.

- Remove
  ```
  *   `Relation#joins` is no longer affected by the target model's
      `current_scope`, with the exception of `unscoped`.
      ([Commit](rails@5c71000))
  ```
  since it was backported to
  `5-1-stable` by 3630d63.

- Remove
  ```
  *   Fix `unscoped(where: [columns])` removing the wrong bind values.
      ([Pull Request](rails#29780))
  ```
  since it was backported to
  `5-1-stable` by d378fcb.

- Remove
  ```
  *   When a `has_one` association is destroyed by `dependent: destroy`,
      `destroyed_by_association` will now be set to the reflection, matching the
      behaviour of `has_many` associations.
      ([Pull Request](rails#29855))
  ```
  since it was backported to
  `5-1-stable` by 8254a8b.

- Remove
  ```
  *   Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT`
      to keep the existing select list.
      ([Pull Request](rails#29848))
  ```
  since it was backported to
  `5-1-stable` by 0e8d4ed.

- Remove
  ```
  *   Ensure `sum` honors `distinct` on `has_many :through` associations.
      ([Commit](rails@566f1fd))
  ```
  since it was backported to
  `5-1-stable` by c0a1dc2.

- Remove
  ```
  *   Fix `COUNT(DISTINCT ...)` for `GROUP BY` with `ORDER BY` and `LIMIT`.
      ([Commit](rails@5668dc6))
  ```
  since it was backported to
  `5-1-stable` by 87ca68e.

- Remove
  ```
  *   MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`.
      ([Commit](rails@9493d45))
  ```
  since it was backported to
  `5-1-stable` by 8b6e694.

- Remove
  ```
  *   Fix longer sequence name detection for serial columns.
      ([Pull Request](rails#28339))
  ```
  since it was backported to
  `5-1-stable` by af9c170
  and
  `5-0-stable` by 7025b1d.

- Remove
  ```
  *   Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
      ar_internal_metadata's data for a test database.
      ([Pull Request](rails#30579))
  ```
  since it was backported to
  `5-1-stable` by bb67b5f
  and
  `5-0-stable` by 60437e6.

- Remove
  ```
  *   Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
      ([Pull Request](rails#31405))
  ```
  since it was backported to
  `5-1-stable` by 5236dda.

- Remove
  ```
  *   Fix `count(:all)` to correctly work `distinct` with custom SELECT list.
      ([Commit](rails@c6cd9a5))
  ```
  since it was backported to
  `5-1-stable` by 6beb4de.

- Remove
  ```
  *   Fix to invoke callbacks when using `update_attribute`.
      ([Commit](rails@732aa34))
  ```
  since it was backported to
  `5-1-stable` by 6346683.

- Remove
  ```
  *   Use `count(:all)` in `HasManyAssociation#count_records` to prevent invalid
      SQL queries for association counting.
      ([Pull Request](rails#27561))
  ```
  since it was backported to
  `5-1-stable` by eef3c89.

- Remove
  ```
  *   Fix `count(:all)` with eager loading and having an order other than
      the driving table.
      ([Commit](rails@ebc09ed))
  ```
  since it was backported to
  `5-1-stable` by 6df9b69.

- Remove
  ```
  *   PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
      ([Pull Request](rails#31671))
  ```
  since it was backported to
  `5-1-stable` by a9c06f6.

- Remove
  ```
  *   Fix that after commit callbacks on update does not triggered
      when optimistic locking is enabled.
      ([Commit](rails@7f9bd03))
  ```
  since it was backported to
  `5-1-stable` by aaee10e.

- Remove
  ```
  *   Fix regression in numericality validator when comparing Decimal and Float
      input values with more scale than the schema.
      ([Pull Request](rails#28584))
  ```
  since it was backported to
  `5-1-stable` by 5b1c3e5.
  Note that there was incorrect link to PR,
  original PR is rails#29249.

- Remove
  ```
  *   Fix to working before/after validation callbacks on multiple contexts.
      ([Pull Request](rails#31483))
  ```
  since it was backported to
  `5-1-stable` by 0f7046a.

- Remove
  ```
  *   Fix implicit coercion calculations with scalars and durations.
      ([Pull Request](rails#29163),
      [Pull Request](rails#29971))
  ```
  since it was backported to
  `5-1-stable` by 51ea27c,
                  4d82e2a.

- Remove
  ```
  *   Fix modulo operations involving durations.
      ([Commit](rails@a54e13b))
  ```
  since it was backported to
  `5-1-stable` by 233fa7e.

- Remove
  ```
  *   Return all mappings for a timezone identifier in `country_zones`.
      ([Commit](rails@cdce6a7))
  ```
  since it was backported to
  `5-1-stable` by 0222ebb.

- Remove
  ```
  *   Add support for compatibility with redis-rb gem for 4.0 version.
      ([Pull Request](rails#30748))
  ```
  since it was backported to
  `5-1-stable` by 3789531.
  Related to rails#32252.

Related to rails#32222, rails#32222 (comment).
Follow up a489cc8.
kamipo added a commit that referenced this pull request May 27, 2018
Since #31405, using `#increment!` with touch option instead of `#touch`
to touch belongs_to association if counter cache is enabled. It caused
the regression since `#increment!` won't invoke after_touch callbacks
even if touch option is given.
To fix the regression, make `#increment!` invokes after_touch callbacks
if touch option is given.

Fixes #31559.
Fixes #32408.
kamipo added a commit that referenced this pull request May 27, 2018
Since #31405, using `#increment!` with touch option instead of `#touch`
to touch belongs_to association if counter cache is enabled. It caused
the regression since `#increment!` won't invoke after_touch callbacks
even if touch option is given.
To fix the regression, make `#increment!` invokes after_touch callbacks
if touch option is given.

Fixes #31559.
Fixes #32408.
kamipo added a commit that referenced this pull request Jun 18, 2018
…thod

`touch` option was added to `increment!` (#27660) and `update_counters`
(#26995). But that option behaves inconsistently with
`Persistence#touch` method.

If `touch` option is passed attribute names, it won't update
update_at/on attributes unlike `Persistence#touch` method.

Due to changed from `Persistence#touch` to `increment!` with `touch`
option, #31405 has a regression that `counter_cache` with `touch` option
which is passed attribute names won't update update_at/on attributes.

I think that the inconsistency is not intended. To get back consistency,
ensure that `touch` option updates update_at/on attributes.
kamipo added a commit to kamipo/rails that referenced this pull request Jun 18, 2018
…thod

`touch` option was added to `increment!` (rails#27660) and `update_counters`
(rails#26995). But that option behaves inconsistently with
`Persistence#touch` method.

If `touch` option is passed attribute names, it won't update
update_at/on attributes unlike `Persistence#touch` method.

Due to changed from `Persistence#touch` to `increment!` with `touch`
option, rails#31405 has a regression that `counter_cache` with `touch` option
which is passed attribute names won't update update_at/on attributes.

I think that the inconsistency is not intended. To get back consistency,
ensure that `touch` option updates update_at/on attributes.
rafaelfranca pushed a commit that referenced this pull request Oct 25, 2018
Since #31405, using `#increment!` with touch option instead of `#touch`
to touch belongs_to association if counter cache is enabled. It caused
the regression since `#increment!` won't invoke after_touch callbacks
even if touch option is given.
To fix the regression, make `#increment!` invokes after_touch callbacks
if touch option is given.

Fixes #31559.
Fixes #32408.
@bogdanvlviv

bogdanvlviv commented Apr 3, 2019 via email •

Copy link
Copy Markdown
Contributor Author

@ghost

ghost commented Apr 3, 2019

Copy link
Copy Markdown

The after_touch callback is not getting called when a record is destroyed. Removing counter_cache gives the expected behaviour. To reproduce, simply use the same setup and try destroying a comment — no touch.

@abhaynikam

Copy link
Copy Markdown
Contributor

@bogdanvlviv @theLucid : I wrote the bug script like mentioned. Seems like it is working on master and on Rails 5.1.7 too.

gem "bundler"

begin
  require "bundler/inline"
rescue LoadError => e
  $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", "5.1.7"
  gem "sqlite3"
  gem "byebug"
end

require "active_record"
require "minitest/autorun"
require "logger"

ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Base.logger = Logger.new(STDOUT)

ActiveRecord::Schema.define do
  create_table :posts do |t|
    t.integer :comments_count, default: 0
    t.integer :lock_version
    t.timestamps
  end

  create_table :comments do |t|
    t.belongs_to :post
  end

  create_table :likes do |t|
    t.belongs_to :post
  end
end

class Post < ActiveRecord::Base
  after_touch :touched

  attr_accessor :after_touch_called

  after_initialize do
    self.after_touch_called = 0
  end

  def touched
    self.after_touch_called += 1
  end
end

class Comment < ActiveRecord::Base
  belongs_to :post, touch: true, counter_cache: true
end

class Like < ActiveRecord::Base
  belongs_to :post, touch: true
end

class BugTest < Minitest::Test
  def test_with_counter_cache
    post = Post.create
    assert_equal 0, post.after_touch_called

    comment = Comment.create(post: post)
    assert_equal 1, post.after_touch_called

    comment.destroy
    assert_equal 2, post.after_touch_called
  end
end

@ghost

ghost commented Apr 3, 2019

Copy link
Copy Markdown

@abhaynikam I'm using Postgresql on Rails 6 beta 3. It doesn't appear to be calling after_touch there on destroy if there is a counter_cache option set.

@Duleja

Duleja commented Feb 22, 2020

Copy link
Copy Markdown

Hi! I am also using PostgreSQL and it seems that the issue is present on Rails 6.0.0.

Both 'touch: true' and 'counter_cache: true' are working fine if used individually, but when combined like this:

belongs_to :some_model, counter_cache: true, touch: true

the associated record from 'some_model' table is not touched (updated), counter cache is incrementing though

@kamipo

kamipo commented Feb 24, 2020

Copy link
Copy Markdown
Member

Can you create a new issue with reproducible script if there is still an issue?

@Duleja

Duleja commented Feb 24, 2020

Copy link
Copy Markdown

Hi! I have actually updated to rails/ruby 2.7.0/6.0.1.2 yesterday.

I tried to recreate the issue on the fresh 2.7.0/6.0.1.2 app and it seems that the issue is not present.
My fault for not checking on fresh an app first. 😞

NOTE:
I still have the issue on the previous app but that could be something with the "IdentityCache" gem that I am using or something else under the hood...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Counter cache conflicts with touch:true by optimistic locking

8 participants