Summary

Users want a profile page that can be visited by other users or guests. This page will feature some biographical and professional information about the user.

GitHub Issue

Proposals

TODO: Wireframes

Profile Data Model

✅ Proposal 1: Add New Model for Profile

We can add a new model for the profile and associate it with a user. These can be created in an after_create callback on users, since I don’t imagine we want users to exist without a profile?

# migration
def change
  create_table :profiles do |t|
    t.references :user, null: false, foreign_key: true
    t.text :bio
    t.string :job_title

    t.timestamps
  end
end

# app/models/profile.rb
class Profile < ApplicationRecord
  belongs_to :user
end

Pros

  1. Splits “profile” stuff out from user. Maintains single responsibility.
  2. This model will quickly grow to include more data around profile images, resume uploads, attached links, etc. If we do proposal 2 and realize we want this model down the line, it’s going to become increasingly annoying to migrate things over to a Profile model.
  3. We should trust language semantics. The fact that this feature is called “profile” and not “user show page” is meaningful.

Cons

  1. With such little data right now, is it necessary to use this approach straight away?

❌ Proposal 2: Add New Columns for this data to User

We can add the data for this new data to our existing users table

# migration
def change
  add_column :bio, :string
end

Pros

  1. Not prematurely introducing a new anemic model