Sha256: 4fff83592ad0fccf1bad96f09913acd82cad580a9e240d0fa35ad954e822539f

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

Contents

# Historiographer::Safe is intended to be used to migrate an existing model
# to Historiographer, not as a long-term solution.
#
# Historiographer will throw an error if a model is saved without a user present,
# unless you explicitly call save_without_history.
#
# Historiographer::Safe will not throw an error, but will rather produce a Rollbar,
# which enables a programmer to find all locations that need to be migrated,
# rather than allowing an unsafe migration to take place.
#
# Eventually the programmer is expected to replace Safe with Historiographer so
# that future programmers will get an error if they try to save without user_id.
#
module Historiographer
  module Safe
    extend ActiveSupport::Concern

    included do
      include Historiographer

      def should_validate_history_user_id_present?
        false
      end

      private

      def history_user_absent_action
        Rollbar.error("history_user_id must be passed in order to save record with histories! If you are in a context with no history_user_id, explicitly call #save_without_history")
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
historiographer-4.1.7 lib/historiographer/safe.rb
historiographer-4.1.5 lib/historiographer/safe.rb
historiographer-4.1.4 lib/historiographer/safe.rb
historiographer-4.1.3 lib/historiographer/safe.rb
historiographer-4.1.2 lib/historiographer/safe.rb
historiographer-4.1.1 lib/historiographer/safe.rb
historiographer-4.1.0 /Users/brettshollenberger/programming/historiographer/lib/historiographer/safe.rb
historiographer-4.0.0 lib/historiographer/safe.rb
historiographer-3.1.2 lib/historiographer/safe.rb
historiographer-3.1.1 lib/historiographer/safe.rb
historiographer-3.1.0 lib/historiographer/safe.rb
historiographer-3.0.0 lib/historiographer/safe.rb
historiographer-2.0.1 lib/historiographer/safe.rb
historiographer-2.0.0 lib/historiographer/safe.rb