Skip to content

Commit 368ee87

Browse files
pimpinclaude
andcommitted
fix: emit NULL literal for nil values in build_update_with_params SET clause
bind(nil) returns Ruby nil which interpolates to "" in a string, producing invalid N1QL like "child.name = ". Restore the old `|| 'NULL'` guard by checking nil before calling bind. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent af0efed commit 368ee87

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/couchbase-orm/relation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ def build_update_with_params(params, **cond)
225225
end
226226
if value.is_a?(Hash)
227227
value.map do |k, v|
228-
"#{key}.#{k} = #{@model.bind(v, params)}"
228+
"#{key}.#{k} = #{v.nil? ? 'NULL' : @model.bind(v, params)}"
229229
end.join(", ") + for_clause
230230
else
231-
"#{key} = #{@model.bind(value, params)}#{for_clause}"
231+
"#{key} = #{value.nil? ? 'NULL' : @model.bind(value, params)}#{for_clause}"
232232
end
233233
end.join(", ")
234234
end

0 commit comments

Comments
 (0)