summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-15 13:39:35 -0600
committermo khan <mo.khan@gmail.com>2020-03-15 13:39:35 -0600
commit390bf52d92216af1538f1a0ea2c2fe4615f53c97 (patch)
treeb632e2ad43d3495004c47b68230713a0cc03a09f
parent836fca2a506c8c153c6dd083d66f57a3ce98e057 (diff)
Combine unique attributes in subclasses into array of qualifications
-rw-r--r--rvh/app/models/employee.rb4
-rw-r--r--rvh/db/migrate/20200315175547_create_accounts.rb1
-rw-r--r--rvh/db/migrate/20200315181211_create_employees.rb12
-rw-r--r--rvh/db/schema.rb6
4 files changed, 5 insertions, 18 deletions
diff --git a/rvh/app/models/employee.rb b/rvh/app/models/employee.rb
index ba59c1a..3a31c17 100644
--- a/rvh/app/models/employee.rb
+++ b/rvh/app/models/employee.rb
@@ -1,16 +1,14 @@
class Employee < ApplicationRecord
belongs_to :account
has_many :treatments
+ attribute :qualifications, :string, array: true
end
class Nurse < Employee
- attribute :certification, :string
end
class Physician < Employee
- attribute :specialty, :string
end
class Technician < Employee
- attribute :skill, :string
end
diff --git a/rvh/db/migrate/20200315175547_create_accounts.rb b/rvh/db/migrate/20200315175547_create_accounts.rb
index 6868a29..c925632 100644
--- a/rvh/db/migrate/20200315175547_create_accounts.rb
+++ b/rvh/db/migrate/20200315175547_create_accounts.rb
@@ -5,6 +5,7 @@ class CreateAccounts < ActiveRecord::Migration[6.0]
t.string :address, null: false
t.datetime :birth_date, null: false
t.string :phone_number
+ t.string :pager_number
t.timestamps
end
diff --git a/rvh/db/migrate/20200315181211_create_employees.rb b/rvh/db/migrate/20200315181211_create_employees.rb
index a2c9fc3..6196c7c 100644
--- a/rvh/db/migrate/20200315181211_create_employees.rb
+++ b/rvh/db/migrate/20200315181211_create_employees.rb
@@ -4,17 +4,7 @@ class CreateEmployees < ActiveRecord::Migration[6.0]
t.references :account, null: false, foreign_key: true
t.string :type
t.datetime :hired_at
-
- # physician
- t.string :specialty
- t.string :pager_number
-
- # technician
- t.string :skill
-
- # nurse
- t.string :certification
-
+ t.text :qualifications # physician.specialty, technician.skill, nurse.certification
t.timestamps
end
add_index :employees, :type
diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb
index 700cfd3..b7be0da 100644
--- a/rvh/db/schema.rb
+++ b/rvh/db/schema.rb
@@ -17,6 +17,7 @@ ActiveRecord::Schema.define(version: 2020_03_15_190540) do
t.string "address", null: false
t.datetime "birth_date", null: false
t.string "phone_number"
+ t.string "pager_number"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
@@ -57,10 +58,7 @@ ActiveRecord::Schema.define(version: 2020_03_15_190540) do
t.integer "account_id", null: false
t.string "type"
t.datetime "hired_at"
- t.string "specialty"
- t.string "pager_number"
- t.string "skill"
- t.string "certification"
+ t.text "qualifications"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["account_id"], name: "index_employees_on_account_id"