I think you're getting a little ahead of yourself. We still haven't made any real decisions about the direction of ActiveModel. Its pretty experimental at this point.
Please feel free to continue to play around but don't assume we are going be taking your direction. Also, I think we are going go w/ rspec too. On Apr 23, 2:12 pm, August Lilleaas <[EMAIL PROTECTED]> wrote: > 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 =) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
