Sha256: 889ac73ac2b06104650753ca2d86f5733f968ef00933e0ed97a7def0bad1e7d5
Contents?: true
Size: 841 Bytes
Versions: 17
Compression:
Stored size: 841 Bytes
Contents
# frozen_string_literal: true # Add Document Statesman Transitions class DocumentTransition < ApplicationRecord include Statesman::Adapters::ActiveRecordTransition # If your transition table doesn't have the default `updated_at` timestamp column, # you'll need to configure the `updated_timestamp_column` option, setting it to # another column name (e.g. `:updated_on`) or `nil`. # # self.updated_timestamp_column = :updated_on # self.updated_timestamp_column = nil belongs_to :document, inverse_of: :document_transitions, foreign_key: "kithe_model_id" after_destroy :update_most_recent, if: :most_recent? private def update_most_recent last_transition = document.document_transitions.order(:sort_key).last return if last_transition.blank? last_transition.update_column(:most_recent, true) end end
Version data entries
17 entries across 17 versions & 1 rubygems