Sha256: e491d137aff0a4cda564d01f3f922e6f7e93b7feba9ef01c0f2164ccddc9442a
Contents?: true
Size: 798 Bytes
Versions: 18
Compression:
Stored size: 798 Bytes
Contents
# frozen_string_literal: true # Add Import Statesman Transitions class ImportTransition < 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 :import, inverse_of: :import_transitions after_destroy :update_most_recent, if: :most_recent? private def update_most_recent last_transition = import.import_transitions.order(:sort_key).last return if last_transition.blank? last_transition.update_column(:most_recent, true) end end
Version data entries
18 entries across 18 versions & 1 rubygems