#428 ✓resolved
Oliver Legg

save! is inconsistent with the behavior of create!

Reported by Oliver Legg | July 1st, 2008 @ 10:06 AM

My expectation for save! would be that it would save the record and raise a PersistenceError if the record was not saved. Instead it saves the record without validations, nearly the exact opposite of what I would expect.

This is inconsistent with the save! method in dm-core which does raise a PersistenceError - (it is also inconsistent with ActiveRecord, but that isn't much of a concern).

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) July 9th, 2008 @ 11:17 PM

    • State changed from “new” to “open”

    Oliver, the convention that Sam has decided upon for DataMapper is that all persistence methods ending in "!" should bypass validations.

    Model#create! is the only method that doesn't match this convention, and it should be fixed.

  • Bernerd Schaefer

    Bernerd Schaefer July 23rd, 2008 @ 11:28 AM

    • State changed from “open” to “resolved”

    Okay. Model#create! now warns that it is deprecated. All uses of create! in the specs have been removed.

    And now dm-validations over-writes Model#create and Model#create! to execute validated and non-validated creates.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages