Sha256: 897f415693be21370f5c66c1db7d68db64ed70c490dc45ecf46bb31762412307
Contents?: true
Size: 826 Bytes
Versions: 16
Compression:
Stored size: 826 Bytes
Contents
# frozen_string_literal: true # Add BulkAction Statesman Transitions class BulkActionTransition < 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 :bulk_action, inverse_of: :bulk_action_transitions after_destroy :update_most_recent, if: :most_recent? private def update_most_recent last_transition = bulk_action.bulk_action_transitions.order(:sort_key).last return if last_transition.blank? last_transition.update_column(:most_recent, true) end end
Version data entries
16 entries across 16 versions & 1 rubygems