Issue from: http://github.com/couchrest/couchrest/issues#issue/18
Hello,
Has anyone already thought of starting to work on something similar to active record's single table inheritance ?
Let's guess two classes :
class User < CouchRest::ExtendedDocument
end
class Admin < User
end
Currently, couchrest wouldn't see that the admin is in fact a user. We couldn't retrieve all users (admins included).
The idea would be, when a class inherits from an other, to add an attribute "couchrest-sti", which would have the subclass value.
When we do a User.all, it's retrieve all the objects having "couchrest-type" defined to user.
But if it has a "couchrest-sti" defined, it'd instantiate the object as the class defined in that attribute. Not as a user.
I really need this. So I'd be willing to work on it. But is it something you'd find useful and that'd have a chance to get implemented to the trunk ?
Issue from: http://github.com/couchrest/couchrest/issues#issue/18
Hello,
Has anyone already thought of starting to work on something similar to active record's single table inheritance ?
Let's guess two classes :
Currently, couchrest wouldn't see that the admin is in fact a user. We couldn't retrieve all users (admins included).
The idea would be, when a class inherits from an other, to add an attribute "couchrest-sti", which would have the subclass value.
When we do a
User.all, it's retrieve all the objects having "couchrest-type" defined to user.But if it has a "couchrest-sti" defined, it'd instantiate the object as the class defined in that attribute. Not as a user.
I really need this. So I'd be willing to work on it. But is it something you'd find useful and that'd have a chance to get implemented to the trunk ?