Skip to content

Business intelligence made simple

Fixed error with Rails 7.1 when no user model

Andrew Kane0d3b28c1e0a2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39e9a7ae..73c35670 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 3.0.1 (unreleased)
+
+- Fixed error with Rails 7.1 when no user model
+
## 3.0.0 (2023-09-20)
- Switched from Mapbox.js to Mapbox GL JS v1 for maps (this affects Mapbox billing)
diff --git a/lib/blazer/run_statement.rb b/lib/blazer/run_statement.rb
index f0cf6c73..40eba3ba 100644
--- a/lib/blazer/run_statement.rb
+++ b/lib/blazer/run_statement.rb
@@ -13,7 +13,8 @@ module Blazer
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