Skip to content

Commit b45b17d

Browse files
committed
fix: use @model.bucket instead of CouchbaseOrm::Connection.bucket in delete_all
`delete_all` was the only method in `CouchbaseOrm_Relation` still using the global `CouchbaseOrm::Connection.bucket`. All other storage accesses (`to_n1ql`, `update_all`, `execute`, `first`, `last`) correctly use `@model.bucket` or `@model.cluster`. This inconsistency was a historical oversight: `delete_all` was introduced in the first commit of the relation class before `@model.bucket` existed, and was never updated when the abstraction was added in later commits. This fix makes `delete_all` consistent with the rest of the class and enables per-model dynamic connection routing (e.g. Couchbase Capella).
1 parent 55c5422 commit b45b17d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/couchbase-orm/relation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def [](*args)
113113
def delete_all
114114
CouchbaseOrm::logger.debug{ "Delete all: #{self}" }
115115
ids = query.to_a
116-
CouchbaseOrm::Connection.bucket.default_collection.remove_multi(ids) unless ids.empty?
116+
@model.bucket.default_collection.remove_multi(ids) unless ids.empty?
117117
end
118118

119119
def where(string_cond=nil, **conds)

0 commit comments

Comments
 (0)