Skip to content

Commit 29e2dfc

Browse files
pimpinclaude
andcommitted
fix: restore to_n1ql to render interpolated values for copy-paste use
to_n1ql delegated to to_n1ql_with_params.first, which returns a query with positional placeholders ($1, $2) instead of literal values. This broke the method's main external use case: producing a query you can copy-paste into the database. Build the query with interpolated values (params: nil) so to_n1ql keeps its previous, human-readable output while to_n1ql_with_params remains the parameterized path used internally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a493c9f commit 29e2dfc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/couchbase-orm/relation.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def to_s
2020
end
2121

2222
def to_n1ql
23-
to_n1ql_with_params.first
23+
bucket_name = @model.bucket.name
24+
where = build_where_with_params(nil)
25+
order = build_order
26+
limit = build_limit
27+
"select raw meta().id from `#{bucket_name}` where #{where} order by #{order} #{limit}"
2428
end
2529

2630
def to_n1ql_with_params

0 commit comments

Comments
 (0)