OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Remove after_initialize hook
Oliver Günther421335d103f7
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rbindex 740e5f46b81..faeee96a44d 100644--- a/app/models/user_preference.rb+++ b/app/models/user_preference.rb@@ -36,8 +36,6 @@ class UserPreference < ApplicationRecordvalidates_presence_of :uservalidate :time_zone_correctness, if: -> { time_zone.present? }- after_initialize :init_settings-### Retrieve keys from settings, and allow accessing# as boolean with ? suffix@@ -137,10 +135,6 @@ class UserPreference < ApplicationRecord%i[user user_id].include?(name.to_sym)end- def init_settings- self.settings ||= {}- end-def time_zone_correctnesserrors.add(:time_zone, :inclusion) if time_zone.present? && canonical_time_zone.nil?enddiff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rbindex 16c02555fcc..dfb0de7c4a0 100644--- a/spec/models/user_preference_spec.rb+++ b/spec/models/user_preference_spec.rb@@ -105,7 +105,7 @@ describe UserPreference do:hide_mail?context 'when a new pref instance' do- subject { UserPreference.new }+ subject { described_class.new }it 'defaults to true' doexpect(subject.settings[:hide_mail]).to be_nil