Module: Journaled
- Defined in:
- app/models/journaled/audit_log/event.rb,
lib/journaled.rb,
lib/journaled/engine.rb,
lib/journaled/errors.rb,
lib/journaled/current.rb,
lib/journaled/version.rb,
lib/journaled/audit_log.rb,
lib/journaled/connection.rb,
lib/journaled/transaction_ext.rb,
app/jobs/journaled/delivery_job.rb,
app/jobs/journaled/application_job.rb
Overview
FIXME: This cannot be included in lib/ because Journaled::Event is autoloaded via app/models
Autoloading Journaled::Event isn't strictly necessary, and for compatibility it would
make sense to move it to lib/.
Defined Under Namespace
Modules: Actor, AuditLog, Changes, Connection, Event, RelationChangeProtection, TransactionExt
Classes: ActorUriProvider, ApplicationJob, Change, ChangeDefinition, ChangeWriter, Current, DeliveryJob, Engine, NotTrulyExceptionalError, TransactionSafetyError, Writer
Constant Summary
collapse
- SUPPORTED_QUEUE_ADAPTERS =
%w(delayed delayed_job good_job que).freeze
- VERSION =
"5.3.2"
Class Method Summary
collapse
Class Method Details
.commit_hash ⇒ Object
47
48
49
|
# File 'lib/journaled.rb', line 47
def self.commit_hash
ENV.fetch('GIT_COMMIT')
end
|
.detect_queue_adapter! ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/journaled.rb', line 59
def self.detect_queue_adapter!
unless SUPPORTED_QUEUE_ADAPTERS.include?(queue_adapter)
raise <<~MSG
Journaled has detected an unsupported ActiveJob queue adapter: `:#{queue_adapter}`
Journaled jobs must be enqueued transactionally to your primary database.
Please install the appropriate gems and set `queue_adapter` to one of the following:
#{SUPPORTED_QUEUE_ADAPTERS.map { |a| "- `:#{a}`" }.join("\n")}
Read more at https://github.com/Betterment/journaled
MSG
end
end
|
.development_or_test? ⇒ Boolean
35
36
37
|
# File 'lib/journaled.rb', line 35
def self.development_or_test?
%w(development test).include?(Rails.env)
end
|
.enabled? ⇒ Boolean
39
40
41
|
# File 'lib/journaled.rb', line 39
def self.enabled?
['0', 'false', false, 'f', ''].exclude?(ENV.fetch('JOURNALED_ENABLED', !development_or_test?))
end
|
.queue_adapter ⇒ Object
55
56
57
|
# File 'lib/journaled.rb', line 55
def self.queue_adapter
job_base_class_name.constantize.queue_adapter_name
end
|
.schema_providers ⇒ Object
43
44
45
|
# File 'lib/journaled.rb', line 43
def self.schema_providers
@schema_providers ||= [Journaled::Engine, Rails]
end
|
.tagged(**tags) ⇒ Object
74
75
76
77
78
79
80
|
# File 'lib/journaled.rb', line 74
def self.tagged(**tags)
existing_tags = Current.tags
tag!(**tags)
yield
ensure
Current.tags = existing_tags
end
|
.transactional_batching_enabled? ⇒ Boolean
23
24
25
|
# File 'lib/journaled.rb', line 23
def self.transactional_batching_enabled?
Thread.current[:journaled_transactional_batching_enabled] || @@transactional_batching_enabled
end
|
.with_transactional_batching ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/journaled.rb', line 27
def self.with_transactional_batching
value_was = Thread.current[:journaled_transactional_batching_enabled]
Thread.current[:journaled_transactional_batching_enabled] = true
yield
ensure
Thread.current[:journaled_transactional_batching_enabled] = value_was
end
|