View for Rails 4: why you should store user profile data in a separate table in the Devise User model table

I use the program, and according to the recommendations on the documents, I have a User model (for development) and a profile model for user data such as names, work, etc. Why is it considered "not very good" to just store all these attributes in the user model table. Just curious.

+6
source share
2 answers

Adding fields to tables defined by an external source may cause transfer errors in future versions of the gem if the gem changes the definition of the table.

Think of the user table as detailing the implementation of a gem. This is usually a bad idea to change the source of an external library because it makes it difficult or impossible to update.

+5
source

Separation of anxiety! The User model is used by devise (which handles app auth and access), and the Profile model handles all business logic.

+2
source

Source: https://habr.com/ru/post/986495/


All Articles