From 3ea7fd80b65cd0f78dd85d80510b840e957dd3c4 Mon Sep 17 00:00:00 2001 From: usernaimandrey Date: Fri, 8 Dec 2023 18:07:22 +0300 Subject: [PATCH] improve model resume --- app/models/resume.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/resume.rb b/app/models/resume.rb index 4c4def5a9..ec2dc4913 100644 --- a/app/models/resume.rb +++ b/app/models/resume.rb @@ -10,9 +10,9 @@ class Resume < ApplicationRecord acts_as_taggable_on :skills, :directions - enumerize :english_fluency, in: %i[dont_know basic read pass_interview fluent] - enumerize :locale, in: %i[en ru], default: :ru - enumerize :relocation, in: %i[not_specified another_country another_city another_city_country not_ready], default: :not_specified + enumerize :english_fluency, in: %i[dont_know basic read pass_interview fluent], scope: true, predicates: { prefix: true } + enumerize :locale, in: I18n.available_locales + enumerize :relocation, in: %i[not_specified another_country another_city another_city_country not_ready], scope: true, predicates: { prefix: true } validates :name, presence: true validates :english_fluency, presence: true, if: -> { locale_ru? } @@ -79,7 +79,8 @@ class Resume < ApplicationRecord def initialize(attribute = nil) defaults = { - locale: I18n.locale + locale: I18n.locale, + relocation: :not_specified } attrs_with_defaults = attribute ? defaults.merge(attribute) : defaults