Summary

Issue Link

Users want to be able to attach links to social media on their profile page.

Proposals

Data Model/DB Design

āœ… Proposal 1: Add New Link Fields for Profiles

The currently existing profiles table could have new fields for each of the links we want to support:

def change
  add_column :profiles, :twitter_link, :string 
  add_column :profiles, :linked_in_link, :string
  add_column :profiles, :github_link, :string
  # etc.
end

Pros

  1. Simple and easy to implement
  2. Easy to clearly define exactly what links we will support

Cons

  1. Not particularly extensible. A new migration needs to be written for each new link type

Proposal 2: Add New Link model

First off: the name of this should probably be less generic. SocialMediaLinks, ProfileLinks, SocialLinks, ā€” something like this is probably a better name. Iā€™m not immediately sure what it should be though.

But the idea would be to create a new table that houses these things.

def change
  create_table :links do |t|
    t.references :profile, null: false, foreign_key: true
    t.string :url, null: false

    t.timestamps
  end
end

Pros

  1. Potential for more flexibility. Users may not be restricted to a certain set of links
  2. System will be easier to extend with any new links