Hi all I'd just like to know what other people think of my interpretation of #save/#save!.
Currently (0.9.x) the behaviour is: #save: save, return true/false depending on success #save!: save unvalidated; raise exception on persistence error My reaction to this is that - ahem - banging the operation changes *two* things about #save: it disables validations and it enables propagation of persistence errors. To me, this makes the behaviour surprising. I think that having a #save method that catches all errors is important - it means you can guarantee your app will not generated an unexpected 500 error. In other words, I'm happy with the current #save. In specs, having the examples fail fast is important. One of the two main conventions of #<method>! is to raise errors (the other being to modify the receiver). So I'm happy that #save! reraises persistence errors. BUT, #save! also disables validations. This means that in a spec, you might create an invalid object that saves with #save!, but save silently fails. To me, these are two dimensions of one problem and need separating, possibly with methods like this: #save #save! #save_without_validations #save_without_validations! WDYAT? Cheers Ashley -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net/ http://twitter.com/ashleymoran --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
