Generally at the time of development a situation of incrementing or decrementing a database field it can come like Number of views for a particular page or Number of views of a individual profile. In rails there are two default functions for this which can increment/decrement DB fields values. Below is the syntax and description of the function:
ModelName is the name of the model class
increment_counter(increment in rails 3) is the function which will increment the database field by 1 with id 5 and views_count is the name of the database field on which the operation will be perform. So if the value was 10 so after this it will update the value as 11. On the other hand there is also a function which do opposite of this the function is decrement_counter(decrement in rails 3).