44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'app/models/concerns/journaled/changes.rb', line 44
def update_columns(attributes, opts = { force: false })
unless opts[:force] || self.class.journaled_attribute_names.empty?
conflicting_journaled_attribute_names = self.class.journaled_attribute_names & attributes.keys.map(&:to_sym)
raise(<<~ERROR) if conflicting_journaled_attribute_names.present?
#update_columns aborted by Journaled::Changes due to journaled attributes:
#{conflicting_journaled_attribute_names.join(', ')}
Call #update instead to ensure journaling or invoke #update_columns
with additional arg `{ force: true }` to override and skip journaling.
ERROR
end
super(attributes)
end
|