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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: