couchrest / couchrest_extended_document

Extends CouchRest with helpers and such
Apache License 2.0
24 stars 5 forks source link

Not always appropriately defining the object's name #5

Closed tapajos closed 14 years ago

tapajos commented 14 years ago

Issue from: http://github.com/couchrest/couchrest/issues#issue/20

Let's guess I have two models :

def Foo < CouchRest::ExtendedDocument
end

def Bar < CouchRest::ExtendedDocument
end

For some reason, I do :

Bar.get 'document_id'

But 'document_id' is not a Bar. It's a Foo ! So we could expect to have a Foo object and it's methods. Instead of that, we have a Bar object.

So it seems that to create the object, CouchRest relies on the class we call it with. Would it be possible to see to return the appropriate object, based on the couchrest-type attribute?

samlown commented 14 years ago

This is fixed in the latest release.