lib/blazer/run_statement.rb in blazer-3.0.0 vs lib/blazer/run_statement.rb in blazer-3.0.1
- old
+ new
@@ -11,10 +11,11 @@
audit_statement = statement.bind_statement
audit_statement += "\n\n#{statement.bind_values.to_json}" if statement.bind_values.any?
audit = Blazer::Audit.new(statement: audit_statement)
audit.query = query
audit.data_source = data_source.id
- audit.user = options[:user]
+ # only set user if present to avoid error with Rails 7.1 when no user model
+ audit.user = options[:user] unless options[:user].nil?
audit.save!
end
start_time = Blazer.monotonic_time
result = data_source.run_statement(statement, options)