views:

63

answers:

2

Hi all,

What is the current practice like to write user-specific configuration settings into a rails application?

For example, privacy settings in a social networking application.

I know application-wide settings can be stored in a .yml file in config/ but what about users?

+2  A: 

I store user-specific information in an ActiveRecord / database model called User.

Larry K
A: 

As usual it depends. if you have a few user config values store them as separate columns on User model. but if you have something more than 10 and it's probable to add other items in the future the best practice is to serialize all the config values and store them in a single column like settings.

ActiveRecord provides some helper methods to serialize data. mix these helpers with active record callbacks (before_save...) and you're good to go.

Allen Bargi