Merge pull request #1709 from Freika/fix/pounts-count-default-value

Add default value for points_count attribute
This commit is contained in:
Evgenii Burmakin 2025-08-29 10:53:17 +02:00 committed by GitHub
commit 04d063ba1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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