Discriminator & Inheritance

30 views
Skip to first unread message

sfeu

unread,
Feb 2, 2012, 12:50:37 PM2/2/12
to DataMapper

Hey, i am currently trying to add support for inheritance-based
queries to the redis-adapter and i got some strange behavior inside
the query object that
is passed to the read function of the adapter.

If i for instance use this class structure like described here:
http://datamapper.org/docs/misc.html

->

class Person
include DataMapper::Resource

property :name, String
property :job, String, :length => 1..255
property :type, Discriminator
property :id, Serial
end

class Woman < Person; end
class Mother < Woman; end
class Daughter < Woman; end

and i query for

Woman.all
or Mother.all

i can receive a conditions from the query object that contains
something like "type IN [Woman, Mother,Daughter]" or "type IN
[Mother]"
which is fine.

But if i query for "Person.all" the condition flied of the query
object is empty?

Is this a bug or do i have to handle discriminator based queries
different inside the read function of an adapter?

Cheers,
Sebastian


Reply all
Reply to author
Forward
0 new messages