I’m making an app with a User model that will use devise for authentication. I’m also seeding it with a lot of data that I already have, and making columns for data that I anticipate having (such as social network profiles and personal information I don’t have yet). As the table columns started to add up, it occurred to me that I might create a User table for authentication data, and then some sort of User_Profile table for details about the user that will appear on their profile page. I’m wondering if this would be a better idea or just stick everything in one table and then continue to add more columns related to the user as i think of them.
User.create!(
devise related columns ommitted....
firstname: "Marcy",
middle: "Eve",
lastname: "Bishopf",
sex: "f",
company: "Johnston Windows",
address: "210-3260 North Dr",
city: "Victoria",
province: "BC",
postal: "V9T 1XS",
email: "mb@blahblah",
phone: "(250) 756-3777",
website: ""
twitter: "",
facebook: "",
linkedin: "",
year: "",
school: ""
motto: ""
more columns for personal data that I haven't thought of yet
)
If I understand correctly, you need to have User Authentication as well as User meta data (name and other profile fields) persisted in the database.
You should definitely normalize the database, User Table for Authentication along with a separate User Profile table referenced by user_id from User Table is preferred.
This is important for the following reasons: