.increment vs += 1

Viewed 41640

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?

3 Answers
Related