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

default_scope not applied to has_many relation?

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

      For class Foo with has_many Bar with a default_scope, I believe foo.bars should be scoped. It currently is not, but foo.bars.all is.

      Steps to repro:

      Create a model Foo with a has_many to model Bar.
      Create an attribute in Bar on which to scope.
      Create a default scope for this attribute.
      Add some instances of Bar to foo.
      Try both foo.bars and foo.bars.all, the first one is scoped, the latter one is not.

      I'm on version 2.4.10

            Assignee:
            Unassigned Unassigned
            Reporter:
            stiller stiller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: