> Coming from ActiveRecord land, I expect both object.save and
> object.save! to run validation before hand.
>
> It turned out that only object.save! skipped validation.
>
> I'm guessing dm-validations only override #save method.

In DataMapper the convention is that any CRUD-type method ending in an
"!" is considered unsafe, and will skip validations and perform the
changes directly on the datastore.  The non-"!" performs the
validations, runs the callbacks, and is the safest approach to use 95%
of the time.

Rather than mirror the ActiveRecord syntax we decided to follow the
Ruby conventions more closely: 
http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist

--

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].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=.


Reply via email to