diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | app/models/vs_code/settings/vs_code_setting.rb | 15 | ||||
-rw-r--r-- | app/models/vs_code/vs_code_setting.rb | 13 |
3 files changed, 16 insertions, 14 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index bebd8316352..4034677509f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -307,7 +307,7 @@ class User < MainClusterwide::ApplicationRecord has_many :awarded_user_achievements, class_name: 'Achievements::UserAchievement', foreign_key: 'awarded_by_user_id', inverse_of: :awarded_by_user has_many :revoked_user_achievements, class_name: 'Achievements::UserAchievement', foreign_key: 'revoked_by_user_id', inverse_of: :revoked_by_user has_many :achievements, through: :user_achievements, class_name: 'Achievements::Achievement', inverse_of: :users - has_many :vscode_settings, class_name: 'VsCode::VsCodeSetting', inverse_of: :user + has_many :vscode_settings, class_name: 'VsCode::Settings::VsCodeSetting', inverse_of: :user # # Validations diff --git a/app/models/vs_code/settings/vs_code_setting.rb b/app/models/vs_code/settings/vs_code_setting.rb new file mode 100644 index 00000000000..e55d958d2b4 --- /dev/null +++ b/app/models/vs_code/settings/vs_code_setting.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module VsCode + module Settings + class VsCodeSetting < ApplicationRecord + belongs_to :user, inverse_of: :vscode_settings + + validates :setting_type, presence: true + validates :content, presence: true + + scope :by_setting_type, ->(setting_type) { where(setting_type: setting_type) } + scope :by_user, ->(user) { where(user: user) } + end + end +end diff --git a/app/models/vs_code/vs_code_setting.rb b/app/models/vs_code/vs_code_setting.rb deleted file mode 100644 index fef3973574a..00000000000 --- a/app/models/vs_code/vs_code_setting.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module VsCode - class VsCodeSetting < ApplicationRecord - belongs_to :user, inverse_of: :vscode_settings - - validates :setting_type, presence: true - validates :content, presence: true - - scope :by_setting_type, ->(setting_type) { where(setting_type: setting_type) } - scope :by_user, ->(user) { where(user: user) } - end -end |