|
|
|
@ -36,8 +36,6 @@ class UserPreference < ApplicationRecord |
|
|
|
|
validates_presence_of :user |
|
|
|
|
validate :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_correctness |
|
|
|
|
errors.add(:time_zone, :inclusion) if time_zone.present? && canonical_time_zone.nil? |
|
|
|
|
end |
|
|
|
|