You can check validity before even attempting the save: if foo.valid? foo.save # party else # handle the validation error end
in this regard, you know for sure you're dealing with an invalid object and you haven't incurred the 50x slowdown of raising an exception. === Adam French afrench PS. DM-Validations also provides for Contextual Validations, which might also scratch your itch better than raising an exception would. On Fri, Nov 28, 2008 at 11:06 PM, Alex Neth <[EMAIL PROTECTED]> wrote: > > Obviously should be: > > unless foo.save > if foo.errors.length > 0 > log "Invalid record: ..." > else > raise UnknownSaveFailure(foo) > end > end > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
