>
> The hook I mentioned should do it. Assuming that validation failures
> are the only cause, then hook it with an :after, and check the errors
> length.
>
> That way, if you still get a save failure, you can exception it if you
> want a little extra guarantee and it'll bubble up:
>
> Foo.hook(:save) { |foo| raise RecordInvalidError.new(foo.errors)
> unless foo.errors.empty? }
>
> if foo.save || raise(PersistenceError.new(foo))
> ...
>
> -SamIn the off chance that PersistenceError is raised, it's nearly useless, since it provides absolutely zero data about what went wrong. I also don't want that ugliness littering my code. This also seems like a rather unfortunate bunch of hoops to jump through when the ORM could just do it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
