2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/journaled/relation_change_protection.rb', line 2
def update_all(updates, force: false)
unless force || !@klass.respond_to?(:journaled_attribute_names) || @klass.journaled_attribute_names.empty?
conflicting_journaled_attribute_names = @klass.journaled_attribute_names & updates.keys.map(&:to_sym)
raise(<<~ERROR) if conflicting_journaled_attribute_names.present?
.update_all aborted by Journaled::Changes due to journaled attributes:
#{conflicting_journaled_attribute_names.join(', ')}
Consider using .all(lock: true) or .find_each with #update to ensure journaling or invoke
.update_all with additional arg `{ force: true }` to override and skip journaling.
ERROR
end
super(updates)
end
|