From: Logan Capaldo Date: 2006-07-21T12:58:59+09:00 Subject: Re: Mongoose 0.1.1 On Jul 20, 2006, at 11:37 PM, Daniel Sheppard wrote: >> But, this limited success leads me to believe that I might be *much* >> more successful using Mongoose with Rails, because Mongoose >> is going to >> stick very close to the ActiveRecord api. So, it might be as easy as >> having your model classes subclass Mongoose::Table, instead of >> ActiveRecord::Base. Things that wouldn't work would be stuff like >> migrations, I think. Also, it would be great if I could >> figure out how >> to get the integrated errors working like the ActiveRecord >> stuff does. >> I haven't really looked at that. > > You've aroused my curiosity. Had a little bit of trouble figuring out > how to use mongoose (some example code would have been nice), but the > following gets some validation going. I couldn't get > validates_presence_of to work for some reason, but here's > validates_numericality_of working. Putting together a > Mongoose::ActiveTable that has most of the functionality of an > activerecord doesn't look to be that difficult. If implementations of > the rest of the methods on ActiveRecord::Base were added, you'd be > able > to use validations and the other activerecord modules. > There's example code distributed with Mongoose. (It's actually the same examples from KirbyBase, re written in a Mongoosian style.)