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

@ -28,6 +28,7 @@ CouchRest::CastedModel.class_eval do
# The to_param method is needed for rails to generate resourceful routes.
# In your controller, remember that it's actually the id of the document.
def id
return nil if base_doc.nil?
base_doc.id
end
alias_method :to_param, :id