Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1374

Overwriting a scope will not be logged

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.3.3
    • Affects Version/s: None
    • Component/s: 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 Durran Jordan
            Reporter:
            asaaki asaaki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: