Skip to content

Commit

Permalink
MONGOID-4698 update warning when overriding criteria methods in scope (
Browse files Browse the repository at this point in the history
…#5442)

* MONGOID-4698 update warning when overriding criteria methods in scope

* Apply suggestions from code review

Co-authored-by: Oleg Pudeyev <[email protected]>

Co-authored-by: Oleg Pudeyev <[email protected]>
  • Loading branch information
Neilshweky and p-mongo committed Aug 15, 2022
1 parent c494c9a commit e3682d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/mongoid/scopable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ def check_scope_name(name)
if Mongoid.scope_overwrite_exception
raise Errors::ScopeOverwrite.new(self.name, name)
else
if Mongoid.logger
Mongoid.logger.warn(
"Creating scope :#{name}. " +
"Overwriting existing method #{self.name}.#{name}."
)
end
Mongoid.logger.warn(
"Creating scope :#{name} which conflicts with #{self.name}.#{name}. " +
"Calls to `#{name}' will delegate to #{self.name}.#{name} and " +
"will ignore the declared scope."
)
end
end
end
Expand Down

0 comments on commit e3682d1

Please sign in to comment.