chore: Add formatting for the view count (#6447)

This commit is contained in:
Pranav Raj S
2023-02-13 14:29:14 -08:00
committed by GitHub
parent caca99a823
commit 98ff185d42
5 changed files with 20 additions and 6 deletions

View File

@@ -106,6 +106,12 @@ class Article < ApplicationRecord
update(status: :draft)
end
def increment_view_count
# rubocop:disable Rails/SkipsModelValidations
update_column(:views, views? ? views + 1 : 1)
# rubocop:enable Rails/SkipsModelValidations
end
private
def ensure_account_id