diff --git a/CHANGELOG.md b/CHANGELOG.md index 71010b06..5854fb91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +# [UNRELEASED] + +## Fixed + +- Default value for `points_count` attribute is now set to 0 in the User model. + # [0.30.12] - 2025-08-26 ## Fixed diff --git a/app/models/user.rb b/app/models/user.rb index 6e1097c9..96d3e3a7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,6 +26,7 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength validates :reset_password_token, uniqueness: true, allow_nil: true attribute :admin, :boolean, default: false + attribute :points_count, :integer, default: 0 enum :status, { inactive: 0, active: 1, trial: 2 } @@ -117,7 +118,7 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength end def trial_state? - points_count.zero? && trial? + (points_count || 0).zero? && trial? end private