Skip to content

Commit f232f5b

Browse files
neilshwekyp-mongo
andauthored
MONGOID-4698 update warning when overriding criteria methods in scope (#5442)
* MONGOID-4698 update warning when overriding criteria methods in scope * Apply suggestions from code review Co-authored-by: Oleg Pudeyev <39304720+p-mongo@users.noreply.github.com> Co-authored-by: Oleg Pudeyev <39304720+p-mongo@users.noreply.github.com>
1 parent 6fbd4b2 commit f232f5b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/mongoid/scopable.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,11 @@ def check_scope_name(name)
249249
if Mongoid.scope_overwrite_exception
250250
raise Errors::ScopeOverwrite.new(self.name, name)
251251
else
252-
if Mongoid.logger
253-
Mongoid.logger.warn(
254-
"Creating scope :#{name}. " +
255-
"Overwriting existing method #{self.name}.#{name}."
256-
)
257-
end
252+
Mongoid.logger.warn(
253+
"Creating scope :#{name} which conflicts with #{self.name}.#{name}. " +
254+
"Calls to `#{name}' will delegate to #{self.name}.#{name} and " +
255+
"will ignore the declared scope."
256+
)
258257
end
259258
end
260259
end

0 commit comments

Comments
 (0)