Simon, > > The bang versions of the CRUD methods are "unsafe" and allow plugin > > Phew! I'm glad I saw this post. I'd been using WRONGLY assuming it > meant the same thing as in AR.
Yeah, I designed the "bang == unsafe" behavior in DM to match more closely how ruby core/stdlib libraries were designed: http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist > I typically like things to fail fast rather than have checks all over the > place. That doesn't seem to be idomatic DM though? I actually prefer the fail fast approach too. That's how I write code, and how I've tried to write DM's API -- if you do something wrong I want it to explode immediately, or as early as possible. I hate it when I do something wrong, but I don't find out until later, after the damage has been done. I've been thinking about this for some time, and I wonder if perhaps the approach Sequel uses for this might be better. I believe they have a global, per-model, and per-resource method like "raise_on_save_failure" that they can set to true/false, and when true it will cause any save failures to raise an exception. I believe the default in Sequel is true, but if I did add something like this to DM it would be false for a few minor releases to give everyone enough time to set it the way they want, and then we'd decide whether to turn it on or off by default. What do you think? -- 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 -~----------~----~----~----~------~----~------~--~---
