Hi Jaques,

> I was under the assumption that Resource::create! and Resource:: save!
> worked like ActiveRecord, where it was just a simple wrapper around
> save that would throw an exception if the validation failed.

The bang versions of the CRUD methods are "unsafe" and allow plugin
authors and people who know what they are doing to get right down to
the metal and perform the action without any constraints or
validations getting in the way.

> What's a good substitute to get the standard activerecord behavior for
> "create!" and "save!"?

While I'm sure someone has created a plugin for this, it would be
trivially simple to implement these methods in a shared module and
include that module in your models.  I recommend people *always*
create a module with some of the common elements in their models
defined in one place, eg:

  http://gist.github.com/170779

This allows you to define any specific behaviors you'd like to see
across your models, and can help "incubate" code before you promote it
up to a plugin.

--

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