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

We can't limit by _type from parent class if STI is use

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      A simple use where it can be usefull is when you want several different Class of subclass but not of all.

      By example from inheritance model we have model Canvas, Browser and Firefox. If you add Safari and Chrome. How have all webkit browser ?

      class Browser < Canvas
      scope :webkit_engine, :where => {:_type.in => ['Safari', 'Chrome']}
      end

      But this scope failed because if we have STI, all the time we request on All _type of only one. You can't search by several.

      So I made a patch in my branch feature-limit-by-type-inheritance-model to do that :

      I made another patch to help made this request by add #type() Criterion

      I think can be great to integrate it.

            Assignee:
            Unassigned Unassigned
            Reporter:
            shingara Cyril Mougel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: