Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/621 Allow more than 2 Nationalities #731

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class Person < ApplicationRecord

validates :nationality,
inclusion: { in: ISO3166::Country.all.collect(&:alpha2) }
validates :nationality2,
inclusion: { in: ISO3166::Country.all.collect(&:alpha2) },
allow_blank: true
# validates :nationality2,
# inclusion: { in: ISO3166::Country.all.collect(&:alpha2) },
# allow_blank: true

validate :picture_size

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ChangeNationality2ToJsonInPeople < ActiveRecord::Migration[7.0]
def up
change_column :people, :nationality2, :json, using: %q{to_json(regexp_split_to_array(nationality2, E'\\\\s+'))}
end

def down
delete_column :people, :nationality2
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_06_03_085509) do
ActiveRecord::Schema[7.0].define(version: 2024_06_17_064850) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -143,7 +143,7 @@
t.bigint "company_id"
t.datetime "associations_updatet_at", precision: nil
t.string "nationality"
t.string "nationality2"
t.json "nationality2"
t.integer "marital_status", default: 0, null: false
t.string "email"
t.integer "department_id"
Expand Down
Loading