This is actually one case where I liked ActiveRecord's approach of using
bang ("!") to be more forceful in intent.a.delete a.save! # raise error if doesn't exist a.delete! # raise error if doesn't exist Michael On Fri, Apr 9, 2010 at 3:09 PM, Jeremy Evans <[email protected]> wrote: > Currently, when you update or delete a Sequel::Model instance, it > doesn't actually check that the database returned that it updated a > row, which leads to interesting situations: > > DB.create_table(:as){primary_key :id} > class A < Sequel::Model; end > a = A.create > a.delete > a.save # no error! > a.delete # no error! > > It's been like this since I took over maintenance. I'm proposing we > add another class/instance flag (strict_modification?), set to true by > default, that will raise an error if you update or delete a model > object and the dataset doesn't return 1 to indicate that a single row > was affected. > > Thoughts? > > Jeremy > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<sequel-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/sequel-talk?hl=en. > > -- http://codeconnoisseur.org -- You received this message because you are subscribed to the Google Groups "sequel-talk" 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/sequel-talk?hl=en.
