Sha256: 3b5dc39cd44b9feed2985fa77dc6f64c6b00d8552e312ed78edc25165e8c7b01

Contents?: true

Size: 535 Bytes

Versions: 12

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

# Add ImportDocument Statesman Transitions
class ImportDocumentTransition < ApplicationRecord
  include Statesman::Adapters::ActiveRecordTransition

  belongs_to :import_document, inverse_of: :import_document_transitions

  after_destroy :update_most_recent, if: :most_recent?

  private

  def update_most_recent
    last_transition = import_document.import_document_transitions.order(:sort_key).last
    return if last_transition.blank?

    last_transition.update_column(:most_recent, true)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
geoblacklight_admin-0.6.0 app/models/import_document_transition.rb
geoblacklight_admin-0.5.1 app/models/import_document_transition.rb
geoblacklight_admin-0.5.0 app/models/import_document_transition.rb
geoblacklight_admin-0.4.2 app/models/import_document_transition.rb
geoblacklight_admin-0.4.1 app/models/import_document_transition.rb
geoblacklight_admin-0.4.0 app/models/import_document_transition.rb
geoblacklight_admin-0.3.2 app/models/import_document_transition.rb
geoblacklight_admin-0.3.1 app/models/import_document_transition.rb
geoblacklight_admin-0.3.0 app/models/import_document_transition.rb
geoblacklight_admin-0.2.1 app/models/import_document_transition.rb
geoblacklight_admin-0.1.0 app/models/import_document_transition.rb
geoblacklight_admin-0.0.1 app/models/import_document_transition.rb