Overwriting a scope will not be logged

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 2.3.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Mongoid will never log a message if somebody overwrites an already defined scope.

      In file:
      https://github.com/mongoid/mongoid/blob/master/lib/mongoid/named_scope.rb#L129

      if !scopes[name] && respond_to?(name, true)
      

      has to be changed to

      if scopes[name] && respond_to?(name, true)
      

      Also would have an option which allows throwing an exception instead of silent logging (more helpful while development imho), maybe something like safe_scoping: true|false (default: false).

              Assignee:
              Durran Jordan
              Reporter:
              asaaki
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: