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.
TODO: Wireframes
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
Profile
model.Cons
We can add the data for this new data to our existing users table
# migration
def change
add_column :bio, :string
end
Pros