summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-15 13:22:25 -0600
committermo khan <mo.khan@gmail.com>2020-03-15 13:22:25 -0600
commit836fca2a506c8c153c6dd083d66f57a3ce98e057 (patch)
tree163ad95ef2deafd6ba32ae8314ad92e579fd4264
parent6d24a76ae681de7d8e14fb3dd1334532abdba125 (diff)
Add employee subclasses
-rw-r--r--rvh/app/models/employee.rb12
-rw-r--r--rvh/db/migrate/20200315181211_create_employees.rb10
-rw-r--r--rvh/db/schema.rb4
-rw-r--r--rvh/db/seeds.rb1
4 files changed, 27 insertions, 0 deletions
diff --git a/rvh/app/models/employee.rb b/rvh/app/models/employee.rb
index b9571d1..ba59c1a 100644
--- a/rvh/app/models/employee.rb
+++ b/rvh/app/models/employee.rb
@@ -2,3 +2,15 @@ class Employee < ApplicationRecord
belongs_to :account
has_many :treatments
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/20200315181211_create_employees.rb b/rvh/db/migrate/20200315181211_create_employees.rb
index 8e96348..a2c9fc3 100644
--- a/rvh/db/migrate/20200315181211_create_employees.rb
+++ b/rvh/db/migrate/20200315181211_create_employees.rb
@@ -5,6 +5,16 @@ class CreateEmployees < ActiveRecord::Migration[6.0]
t.string :type
t.datetime :hired_at
+ # physician
+ t.string :specialty
+ t.string :pager_number
+
+ # technician
+ t.string :skill
+
+ # nurse
+ t.string :certification
+
t.timestamps
end
add_index :employees, :type
diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb
index 7a55399..700cfd3 100644
--- a/rvh/db/schema.rb
+++ b/rvh/db/schema.rb
@@ -57,6 +57,10 @@ 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.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"
diff --git a/rvh/db/seeds.rb b/rvh/db/seeds.rb
new file mode 100644
index 0000000..a788dba
--- /dev/null
+++ b/rvh/db/seeds.rb
@@ -0,0 +1 @@
+puts "Create seed data"