{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/30779","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/30779/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/30779/comments","events_url":"https://api.github.com/repos/rails/rails/issues/30779/events","html_url":"https://github.com/rails/rails/issues/30779","id":262216408,"number":30779,"title":"after_commit on update isn't triggered","user":{"login":"ahorek","id":9540855,"avatar_url":"https://avatars2.githubusercontent.com/u/9540855?v=4","gravatar_id":"","url":"https://api.github.com/users/ahorek","html_url":"https://github.com/ahorek","followers_url":"https://api.github.com/users/ahorek/followers","following_url":"https://api.github.com/users/ahorek/following{/other_user}","gists_url":"https://api.github.com/users/ahorek/gists{/gist_id}","starred_url":"https://api.github.com/users/ahorek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahorek/subscriptions","organizations_url":"https://api.github.com/users/ahorek/orgs","repos_url":"https://api.github.com/users/ahorek/repos","events_url":"https://api.github.com/users/ahorek/events{/privacy}","received_events_url":"https://api.github.com/users/ahorek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-10-02T20:27:41Z","updated_at":"2018-03-27T20:10:19Z","closed_at":"2018-01-09T02:59:45Z","author_association":"NONE","body":"### Steps to reproduce\r\n\r\n```ruby\r\n# frozen_string_literal: true\r\n\r\nbegin\r\n  require \"bundler/inline\"\r\nrescue LoadError => e\r\n  $stderr.puts \"Bundler version 1.10 or later is required. Please update your Bundler\"\r\n  raise e\r\nend\r\n\r\ngemfile(true) do\r\n  source \"https://rubygems.org\"\r\n  #gem \"rails\", github: \"rails/rails\"\r\n  #gem \"arel\", github: \"rails/arel\"\r\n  gem \"rails\", '5.1.4'\r\n  gem \"sqlite3\"\r\n  gem \"pg\"\r\n  gem \"mysql2\"\r\n  gem \"pry\"\r\nend\r\n\r\nrequire \"active_record\"\r\nrequire \"minitest/autorun\"\r\nrequire \"logger\"\r\n\r\n# This connection will do for database-independent bug reports.\r\nActiveRecord::Base.establish_connection(adapter: \"sqlite3\", database: \":memory:\")\r\n#ActiveRecord::Base.establish_connection(adapter: \"postgresql\", database: \"\", username: '', password: \"\")\r\n#ActiveRecord::Base.establish_connection(adapter: \"mysql2\", database: \"\", username: '', password: \"\")\r\nActiveRecord::Base.logger = Logger.new(STDOUT)\r\n\r\nActiveRecord::Schema.define do\r\n  create_table :posts, force: true do |t|\r\n    t.string :name\r\n    t.integer :lock_version\r\n  end\r\nend\r\n\r\nclass Post < ActiveRecord::Base\r\n  after_commit :test_create, :on => :create\r\n  after_commit :test_update, :on => :update\r\n  after_commit :test_destroy, :on => :destroy\r\n\r\n  attr_accessor :status\r\n\r\n  def test_create\r\n    self.status = 'create'\r\n  end\r\n\r\n  def test_update\r\n    self.status = 'update'\r\n  end\r\n\r\n  def test_destroy\r\n    self.status = 'destroy'\r\n  end\r\nend\r\n\r\nclass BugTest < Minitest::Test\r\n  def test_create\r\n    post = Post.create!\r\n    assert_equal 'create', post.status\r\n  end\r\n\r\n  def test_update\r\n    post = Post.create!\r\n    post.update_attributes(:name => 'xxx')\r\n    assert_equal 'update', post.status\r\n  end\r\n\r\n  def test_destroy\r\n    post = Post.create!\r\n    post.destroy\r\n    assert_equal 'destroy', post.status\r\n  end\r\nend\r\n```\r\n\r\n### Expected behavior\r\nafter_commit :test_update, :on => :update calls callbacks\r\n\r\n### Actual behavior\r\nafter_commit :test_update, :on => :update isn't triggered since rails 5.1.0.beta1 and on master, previous versions are fine\r\nthe problem is only on models that contain \"**lock_version**\" column\r\n\r\n### System configuration\r\n**Rails version**:\r\n> 5.1.0.beta1\r\n\r\n**Ruby version**:\r\n> 2.4.2"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/376658424","html_url":"https://github.com/rails/rails/issues/30779#issuecomment-376658424","issue_url":"https://api.github.com/repos/rails/rails/issues/30779","id":376658424,"user":{"login":"aprescott","id":342081,"avatar_url":"https://avatars0.githubusercontent.com/u/342081?v=4","gravatar_id":"","url":"https://api.github.com/users/aprescott","html_url":"https://github.com/aprescott","followers_url":"https://api.github.com/users/aprescott/followers","following_url":"https://api.github.com/users/aprescott/following{/other_user}","gists_url":"https://api.github.com/users/aprescott/gists{/gist_id}","starred_url":"https://api.github.com/users/aprescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aprescott/subscriptions","organizations_url":"https://api.github.com/users/aprescott/orgs","repos_url":"https://api.github.com/users/aprescott/repos","events_url":"https://api.github.com/users/aprescott/events{/privacy}","received_events_url":"https://api.github.com/users/aprescott/received_events","type":"User","site_admin":false},"created_at":"2018-03-27T20:10:19Z","updated_at":"2018-03-27T20:10:19Z","author_association":"CONTRIBUTOR","body":"I also just encountered this on Rails 5.1.5. My understanding was that `after_commit` callbacks were intended to run automatically after #18458. Is that no longer true?"}}
{"actor":{"display_login":"aprescott"}}