Skip to content

Commit 014cfb8

Browse files
committed
Don't use nil as payload key.
Because it is then turned into an empty string key in json and Elasticsearch refuses to parse it. Fixes reidmorrison#131
1 parent c018c6a commit 014cfb8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rails_semantic_logger/active_record/log_subscriber.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def render_bind_v6_1(attr, value)
178178
attr = nil
179179
end
180180

181-
[attr&.name, value]
181+
[attr&.name || :nil, value]
182182
end
183183

184184
def type_casted_binds_v5_0_3(binds, casted_binds)

test/active_record_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ActiveRecordTest < Minitest::Test
9090
if Rails.version.to_f >= 6.1
9191
# Rails 6.1 dropped the bound column name
9292
# Can be removed once this PR is fixed: https://github.com/rails/rails/pull/41068
93-
assert_equal [2, 3], binds[nil], -> { actual.ai }
93+
assert_equal [2, 3], binds[:nil], -> { actual.ai }
9494
else
9595
assert_equal [2, 3], binds[:age], -> { actual.ai }
9696
end

0 commit comments

Comments
 (0)