{"action":"created","issue":{"url":"https://api.github.com/repos/gocardless/statesman/issues/306","repository_url":"https://api.github.com/repos/gocardless/statesman","labels_url":"https://api.github.com/repos/gocardless/statesman/issues/306/labels{/name}","comments_url":"https://api.github.com/repos/gocardless/statesman/issues/306/comments","events_url":"https://api.github.com/repos/gocardless/statesman/issues/306/events","html_url":"https://github.com/gocardless/statesman/pull/306","id":292475243,"number":306,"title":"Make the \"updated timestamp column\" for an ActiveRecord transition configurable","user":{"login":"timrogers","id":116134,"avatar_url":"https://avatars3.githubusercontent.com/u/116134?v=4","gravatar_id":"","url":"https://api.github.com/users/timrogers","html_url":"https://github.com/timrogers","followers_url":"https://api.github.com/users/timrogers/followers","following_url":"https://api.github.com/users/timrogers/following{/other_user}","gists_url":"https://api.github.com/users/timrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/timrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timrogers/subscriptions","organizations_url":"https://api.github.com/users/timrogers/orgs","repos_url":"https://api.github.com/users/timrogers/repos","events_url":"https://api.github.com/users/timrogers/events{/privacy}","received_events_url":"https://api.github.com/users/timrogers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-01-29T16:37:14Z","updated_at":"2018-02-02T18:03:35Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/gocardless/statesman/pulls/306","html_url":"https://github.com/gocardless/statesman/pull/306","diff_url":"https://github.com/gocardless/statesman/pull/306.diff","patch_url":"https://github.com/gocardless/statesman/pull/306.patch"},"body":"In #285, we introduced a change such that, when transitioning a model to a new state, we go back to its old transitions and reset their `most_recent` using `ActiveRecord::Relation#update_all` (relying on the database to find the old transitions, bypassing ActiveRecord's in memory data), whilst also touching their `updated_at` timestamp to show that we've updated those records.\r\n\r\nHowever, we can't necessarily assume that these transition models will have an `updated_at`. They might have an `updated_on` ([1][]), nothing or something else entirely.\r\n\r\nThis makes the \"updated timestamp column\" configurable as part of the transition, like this, defaulting to the Rails default, `:updated_at`:\r\n\r\n```ruby\r\nclass MyActiveRecordModelTransition < ActiveRecord::Base\r\n  include Statesman::Adapters::ActiveRecordTransition\r\n\r\n  self.updated_timestamp_column = :updated_on\r\n\r\n  belongs_to :my_active_record_model\r\nend\r\n```\r\n\r\nWe do this by defining a `class_attribute` on `Statesman::Adapters::ActiveRecordTransition`.\r\n\r\nFixes #305.\r\n\r\n[1]: http://api.rubyonrails.org/classes/ActiveRecord/Timestamp.html#method-i-timestamp_attributes_for_update_in_model"},"comment":{"url":"https://api.github.com/repos/gocardless/statesman/issues/comments/362659450","html_url":"https://github.com/gocardless/statesman/pull/306#issuecomment-362659450","issue_url":"https://api.github.com/repos/gocardless/statesman/issues/306","id":362659450,"user":{"login":"timrogers","id":116134,"avatar_url":"https://avatars3.githubusercontent.com/u/116134?v=4","gravatar_id":"","url":"https://api.github.com/users/timrogers","html_url":"https://github.com/timrogers","followers_url":"https://api.github.com/users/timrogers/followers","following_url":"https://api.github.com/users/timrogers/following{/other_user}","gists_url":"https://api.github.com/users/timrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/timrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timrogers/subscriptions","organizations_url":"https://api.github.com/users/timrogers/orgs","repos_url":"https://api.github.com/users/timrogers/repos","events_url":"https://api.github.com/users/timrogers/events{/privacy}","received_events_url":"https://api.github.com/users/timrogers/received_events","type":"User","site_admin":false},"created_at":"2018-02-02T18:03:35Z","updated_at":"2018-02-02T18:03:35Z","author_association":"MEMBER","body":"@hmac Done!"}}
{"actor":{"display_login":"timrogers"}}