base_doc should be nil for unassociated casted models

This commit is contained in:
Peter Gumeson 2009-05-30 23:20:39 -07:00
parent 027dd9a3ee
commit 91cd1d9c7b
3 changed files with 7 additions and 1 deletions

View file

@ -30,7 +30,7 @@ module CouchRest
# Gets a reference to the top level extended
# document that a model is saved inside of
def base_doc
raise "Cannot call base_doc on a model that is not yet casted by a document" unless @casted_by
return nil unless @casted_by
@casted_by.base_doc
end