Feature/update confirmation email information (#145)

* Add `invited_by` foreign key to User

Allows for a User to be tied to the user who invited them

* Include `current_user` in new agent initialization parameters

* Add `shoulda-matchers` for testing associations

* Add Inviter information and associated account to welcome email

* Only show inviter info if applicable

* Update conversation spec for FFaker compatibility
This commit is contained in:
Lauren
2019-10-14 04:54:58 -04:00
committed by Sojan Jose
parent 4b33a480c7
commit b89353b76c
13 changed files with 113 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
class AddInvitedByToUser < ActiveRecord::Migration[6.1]
def change
add_reference(:users, :inviter, foreign_key: { to_table: :users })
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_08_19_010457) do
ActiveRecord::Schema.define(version: 2019_10_14_051743) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -205,9 +205,12 @@ ActiveRecord::Schema.define(version: 2019_08_19_010457) do
t.datetime "updated_at", null: false
t.string "channel"
t.integer "role", default: 0
t.bigint "inviter_id"
t.index ["email"], name: "index_users_on_email"
t.index ["inviter_id"], name: "index_users_on_inviter_id"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
end
add_foreign_key "users", "users", column: "inviter_id"
end