Hello, World!
I've been doing some hacking on ActiveModel, and I'm pretty satisfied with the results. Mmost of the validations stuff is finished. Callbacks and observing is yet to come (though Rick Olson has done some work on the observers).
Here's one of the tests, which mocks an active record implementation of AtiveModel: http://pastie.org/185638
It lets you overwrite default validation settings. It detects if the implementation defines new_record?, if it does, ActiveModel activates new/existing record differences. If it doesn't, stuff like :on => :update is ignored.
The API is pretty clean, and yes, the tests pass ; ) I'm poking around with error messages now, trying out various approaches. I think the basic idea of Errors < Hash is DHH's, and I really based my stuff on his approach, just tweaking it a bit. For instance, instead of user.errors[:base] << "foo", I've done user.errors << "Foo" (which was to be honest Pratik's idea). Also, instead of user.errors[:base] for yielding them, I'm doing user.errors.on_base. It's a very different kind of error than the attribute-based errors you add with foo.erros[:bar], so I think it makes sense to have the api different for those as well.
Certain things makes backwards compability hard, though. I've changed it so that adding errors on base causes the record to be invalid, which as far as I know breaks backwards compability (this is the first time I hack around whith in-deep rails stuff like this, so do arrest me on this if I'm wrong). Therefore, aiming for ActiveModel being a none backwards compatible 3.0 thing would make sense. As mentioned, it would really easen the process of coding it, and makes it less hacky. And it really affects active record as well, involving a lot of re- writing, so the 3.0 badge would indeed be deserved for a release like this.
So, that's it. My work so far is available on github, http://github.com/leethal/rails/tree/activemodel_cleanup/activemodel. I hope you like what I've done so far, I've really enjoyed hacking on this. Comments appreciated =)