shootnix/activerecord-simple — pull request #30 by lifeofguenter (2014-05-12 09:30:59+00:00)
Title: add increment / decrement methods

In such cases were you need to simply increment / decrement the value of a column (e.g. post-counter, view-counter) you might (or me in this case) want to have access to a simple method that can do that for you in a safely (race condition) manner.

my $foo = Foo::Model::Article->get(42);
say $foo->views;
$foo->increment('views');
say $foo->views;

This merge is a working proof of concept. In future maybe it would be better to implement something like "post_increment" or something, which basically just modifies the base-SQL and waits for save() to be triggered. With that other updates can be done without wasting a SQL Query.