You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Transport
include Mongoid::Document
include MongoidEnumerable
enumerable :terrain, %w[land water]
end
class Car < Transport; end
class Boat < Transport; end
Now, running:
Car.all gives the following criteria
=> #<Mongoid::Criteria
selector: {}
options: {}
class: Car
embedded: false>
Car.land gives the following criteria
=> #<Mongoid::Criteria
selector: {"terrain"=>"land"}
options: {}
class: Transport
embedded: false>
Notice how Car.land sets the selector {"terrain"=>"land"} correctly, but sets the class to the superclass Transport, so Car.land will give you all Vehicles of land terrain instead of just cars with land terrain
I'll try to see if I can fix it myself and send you a PR
The text was updated successfully, but these errors were encountered:
Steps to reproduce:
Define the following classes:
Now, running:
Car.all
gives the following criteriaCar.land
gives the following criteriaNotice how
Car.land
sets the selector{"terrain"=>"land"}
correctly, but sets the class to the superclass Transport, soCar.land
will give you all Vehicles of land terrain instead of just cars with land terrainI'll try to see if I can fix it myself and send you a PR
The text was updated successfully, but these errors were encountered: