Commit c6f5bb67cac28a41ef8a435798634824db5c4028
1 parent
ad15c85e
Exists in
master
and in
29 other branches
ActionItem908: using increment! instead of manually doing the increment
Showing
1 changed file
with
1 additions
and
2 deletions
Show diff stats
app/models/article.rb
| @@ -221,8 +221,7 @@ class Article < ActiveRecord::Base | @@ -221,8 +221,7 @@ class Article < ActiveRecord::Base | ||
| 221 | end | 221 | end |
| 222 | 222 | ||
| 223 | def hit | 223 | def hit |
| 224 | - self.hits += 1 | ||
| 225 | - save! | 224 | + self.increment!(:hits) |
| 226 | end | 225 | end |
| 227 | 226 | ||
| 228 | def can_display_hits? | 227 | def can_display_hits? |