Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/logidze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class << self
# By default we do not set +log_data_placement+ value and rely on `has_logidze` macros
attr_accessor :log_data_placement

# Determines whether or not with_meta and with_responsible wrap their block
# in a transaction. Defaults to true.
attr_accessor :transactional_default


# Temporary disable DB triggers.
#
# @example
Expand Down Expand Up @@ -87,4 +92,5 @@ def with_logidze_setting(name, value)
self.on_pending_upgrade = :ignore
self.sort_triggers_by_name = false
self.log_data_placement = nil
self.transactional_default = true
end
4 changes: 2 additions & 2 deletions lib/logidze/meta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
module Logidze # :nodoc:
# Provide methods to attach meta information
module Meta
def with_meta(meta, transactional: true, &block)
def with_meta(meta, transactional: Logidze.transactional_default, &block)
wrapper = transactional ? MetaWithTransaction : MetaWithoutTransaction
wrapper.wrap_with(meta, &block)
end

def with_responsible(responsible_id, transactional: true, &block)
def with_responsible(responsible_id, transactional: Logidze.transactional_default, &block)
return yield if responsible_id.nil?

meta = {Logidze::History::Version::META_RESPONSIBLE => responsible_id}
Expand Down
Loading