chore: Add formatting for the view count (#6447)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user