I have a Picture model that contains a variable for a view count (integer).
The view count is incremented by +1 every time someone views the Picture object.
In getting this done, what is the difference between
@picture.view_count += 1
@picture.save
and
@picture.increment(:view_count, 1)
also if i use increment, is .save necessary?
The source of
incrementis below, which initializes attribute to zero if nil and adds the value passed as by (default is 1), it does not do save, so.saveis still necessary.