{"action":"created","issue":{"url":"https://api.github.com/repos/airblade/paper_trail/issues/1073","repository_url":"https://api.github.com/repos/airblade/paper_trail","labels_url":"https://api.github.com/repos/airblade/paper_trail/issues/1073/labels{/name}","comments_url":"https://api.github.com/repos/airblade/paper_trail/issues/1073/comments","events_url":"https://api.github.com/repos/airblade/paper_trail/issues/1073/events","html_url":"https://github.com/airblade/paper_trail/issues/1073","id":310456083,"number":1073,"title":"[v9.0.0] Difference between `#touch` and `#paper_trail.touch_with_version`?","user":{"login":"fukayatsu","id":1041857,"avatar_url":"https://avatars1.githubusercontent.com/u/1041857?v=4","gravatar_id":"","url":"https://api.github.com/users/fukayatsu","html_url":"https://github.com/fukayatsu","followers_url":"https://api.github.com/users/fukayatsu/followers","following_url":"https://api.github.com/users/fukayatsu/following{/other_user}","gists_url":"https://api.github.com/users/fukayatsu/gists{/gist_id}","starred_url":"https://api.github.com/users/fukayatsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fukayatsu/subscriptions","organizations_url":"https://api.github.com/users/fukayatsu/orgs","repos_url":"https://api.github.com/users/fukayatsu/repos","events_url":"https://api.github.com/users/fukayatsu/events{/privacy}","received_events_url":"https://api.github.com/users/fukayatsu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-02T10:53:54Z","updated_at":"2018-04-23T03:58:40Z","closed_at":"2018-04-23T03:58:40Z","author_association":"NONE","body":"Is this an expected behavior?\r\n\r\n### my_bug_report.rb\r\n\r\n```ruby\r\n# frozen_string_literal: true\r\n\r\n# Use this template to report PaperTrail bugs.\r\n# Please include only the minimum code necessary to reproduce your issue.\r\nrequire \"bundler/inline\"\r\n\r\n# STEP ONE: What versions are you using?\r\ngemfile(true) do\r\n  ruby \"2.5.0\"\r\n  source \"https://rubygems.org\"\r\n  gem \"activerecord\", \"5.1.4\"\r\n  gem \"minitest\", \"5.10.3\"\r\n  gem \"paper_trail\", \"9.0.0\", require: false\r\n  gem \"sqlite3\"\r\nend\r\n\r\nrequire \"active_record\"\r\nrequire \"minitest/autorun\"\r\nrequire \"logger\"\r\n\r\n# Please use sqlite for your bug reports, if possible.\r\nActiveRecord::Base.establish_connection(adapter: \"sqlite3\", database: \":memory:\")\r\nActiveRecord::Base.logger = nil\r\nActiveRecord::Schema.define do\r\n  # STEP TWO: Define your tables here.\r\n  create_table :users, force: true do |t|\r\n    t.text :first_name, null: false\r\n    t.timestamps null: false\r\n  end\r\n\r\n  create_table :versions do |t|\r\n    t.string :item_type, null: false\r\n    t.integer :item_id, null: false\r\n    t.string :event, null: false\r\n    t.string :whodunnit\r\n    t.text :object, limit: 1_073_741_823\r\n    t.text :object_changes, limit: 1_073_741_823\r\n    t.integer :transaction_id\r\n    t.datetime :created_at\r\n  end\r\n  add_index :versions, %i[item_type item_id]\r\n  add_index :versions, [:transaction_id]\r\n\r\n  create_table :version_associations do |t|\r\n    t.integer  :version_id\r\n    t.string   :foreign_key_name, null: false\r\n    t.integer  :foreign_key_id\r\n  end\r\n  add_index :version_associations, [:version_id]\r\n  add_index :version_associations, %i[foreign_key_name foreign_key_id],\r\n    name: \"index_version_associations_on_foreign_key\"\r\nend\r\nActiveRecord::Base.logger = Logger.new(STDOUT)\r\nrequire \"paper_trail/config\"\r\n\r\n# STEP THREE: Configure PaperTrail as you would in your initializer\r\nPaperTrail::Config.instance.track_associations = true\r\n\r\nrequire \"paper_trail\"\r\n\r\n# STEP FOUR: Define your AR models here.\r\nclass User < ActiveRecord::Base\r\n  has_paper_trail\r\nend\r\n\r\n# STEP FIVE: Please write a test that demonstrates your issue.\r\nclass BugTest < ActiveSupport::TestCase\r\n  def test_touch_with_version\r\n    user = User.create(first_name: \"Jane\")\r\n    user.paper_trail.touch_with_version\r\n    assert_equal 'Jane', user.versions.last.reify.first_name\r\n  end\r\n\r\n  def test_touch\r\n    user = User.create(first_name: \"Jane\")\r\n    user.touch\r\n    assert_equal 'Jane', user.versions.last.reify.first_name\r\n  end\r\nend\r\n\r\n# STEP SIX: Run this script using `ruby my_bug_report.rb`\r\n```\r\n\r\n### result\r\n\r\n```\r\n  1) Failure:\r\nBugTest#test_touch [report.rb:77]:\r\nExpected: \"Jane\"\r\n  Actual: nil\r\n\r\n2 runs, 2 assertions, 1 failures, 0 errors, 0 skips\r\n```"},"comment":{"url":"https://api.github.com/repos/airblade/paper_trail/issues/comments/383447707","html_url":"https://github.com/airblade/paper_trail/issues/1073#issuecomment-383447707","issue_url":"https://api.github.com/repos/airblade/paper_trail/issues/1073","id":383447707,"user":{"login":"jaredbeck","id":380809,"avatar_url":"https://avatars2.githubusercontent.com/u/380809?v=4","gravatar_id":"","url":"https://api.github.com/users/jaredbeck","html_url":"https://github.com/jaredbeck","followers_url":"https://api.github.com/users/jaredbeck/followers","following_url":"https://api.github.com/users/jaredbeck/following{/other_user}","gists_url":"https://api.github.com/users/jaredbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredbeck/subscriptions","organizations_url":"https://api.github.com/users/jaredbeck/orgs","repos_url":"https://api.github.com/users/jaredbeck/repos","events_url":"https://api.github.com/users/jaredbeck/events{/privacy}","received_events_url":"https://api.github.com/users/jaredbeck/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T03:58:40Z","updated_at":"2018-04-23T03:58:40Z","author_association":"COLLABORATOR","body":"> Not sure but what you are describing here may be the same as this: #1076\r\n\r\nClosing via https://github.com/airblade/paper_trail/pull/1078."}}
{"actor":{"display_login":"jaredbeck"}}