Simon,

On Sep 27, 2:53 am, Simon Harris <[email protected]> wrote:
> > Dan, I agree with your logic on using ! as an unsafe indicator,
> > however I think its worth considering future ActiveRecord switchers
> > (many who will try Datamapper when Rails3 is out).
>
> Hmm. yes and no. DM is quite different to A/R. I'm not opposed to
> allowing it to behave similarly by some mechanism but I think
> idiomatic DM shouldn't carry the baggage of A/R for the sake of
> converting users.

I agree.  There are parts of DM that are similar to AR, and parts that
are very different.  AR was a large influence on DM's API design, but
when there is a better approach we shouldn't hesitate to diverge or
try a completely different approach.

With that said, I would not be opposed to converting dm-ar-finders
into a layer that brings some of the AR conventions into DM if it
makes things easier for people to migrate over.  If anyone wants to
take this on please let me know.

> Personally, I want a tool that is internally consistent, with a
> considered API supported by a small, active, thoughtful and engaging
> community. I'm over catering to the lowest common denominator just to
> increase numbers.

I agree.  We go to alot of effort to make sure DM remains ruby-ish,
and the syntax is natural and consistent with other parts of DM.  The
behavior of Resource#save! might not seem totally useful until you
look at the behavior of bang methods across all of DM:

Model#create!
Collection#create!

*Model#update!
Collection#update!
Resource#update!

*Model#destroy!
Collection#destroy!
Resource#destroy!

Collection#save!
Resource#save!

All of these methods has a corresponding "safe" version that executes
all the validations, and respects all the constraints.  The above
methods bypass all of those and operate directly on the datastore.
When possible, as in the case of the Model and Collection methods, the
data is modified directly without even lazy loading anything.  While
Resource#save! might not be something you use all the time, it is
consistent with the other CRUD methods in DM.

*NOTE: Model#update! and Model#destroy! are not yet implemented, but
are part of the planned 1.0 API: http://gist.github.com/152102

--

Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to