I have a question to ask you. There are a lot of ways to implement account settings. I’ll name three here. What’s your favorite option?
On User model
In this settings type, all the settings are made available on the User model of your web application. So, for example, each setting has it’s own column on the users table. The settings can be fetched by using User.setting directly from your MVC framework.
The advantage of this is that it is easy to set up. The disadvantage is that it is non-scalable as hell. You would be ending up with 20+ columns in a users table.
Key-value pairs
This method is used by – for example – WordPress. They have a separate wp_usermeta table with the following relevant columns: user_id, meta_key, meta_value. This way, each user can have more settings than the default user stuff like password and username.
Disadvantage is that it will take more work to nicely bind all the keys as attributes to the User model. Advantage is that it is scalable.
Hash on the Model
A third option implements both. You would put one column named “settings” on the User model and fill it with a serialized text-based hash (ie. YAML) and deserialize it every time you read or save settings. The Rails plugin acts_as_configurable does this.
What’s your take on this?

