#42 new
Marcos Tapajós

Bulk save of extended docs with timestamps! does not save created_at or updated_at fields

Reported by Marcos Tapajós | October 19th, 2009 @ 09:28 AM

Reported by grempe on github

When a model is created that extends Couchrest::ExtendedDocument and it has the 'timestamps!' property in the model it is expected that a 'created_at' and 'updated_at' timestamp field will be created when the document is saved. It should not matter if the document was saved singly or using the bulk save mechanism.

This only works as expected when docs are created and saved singly. Bulk document saves do not create the expected fields.

Please find an example of this at : http://pastie.org/652473

The example first shows creating and saving an individual doc with timestamps created properly. The second part shows creating multiple docs and bulk saving them with no timestamps created after save.

Comments and changes to this ticket

  • Marcos Tapajós

    Marcos Tapajós October 19th, 2009 @ 10:47 AM

    Timestamp! is a feature of Couchrest::ExtendedDocument. Is is a method of that create two properties and setup some callbacks. Your problem is that you are using the bulk_save of CouchRest::Database and not an ExtendedDocument.

    Maybe the correct is implement a bulk save on Couchrest::ExtendedDocument. Well, it isn't a bug.

    I can't close this ticket but for me it is closed because it isn't a bug.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

"CouchDB, close to the metal." <a href="http://github.com/jchris/couchrest/tree/master">CouchRest</a> is a RESTful layer for accessing CouchDB, based off CouchDB's included Javascript reference client. CouchRest also includes helpers for running large queries etc. There is also a base class for ActiveRecord / Datamapper style ORM, called CouchRest::Model.

People watching this ticket

Pages