Forum: Ruby on Rails Storing user specific settings

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
pankaj (Guest)
on 2009-02-13 21:13
(Received via mailing list)
I need to store user specific settings in database.
Which is a better approach

storing them in one row with each column for each setting
Table columns in these case would be
 id, user_id, setting 1, setting 2, setting 3 etc


storing them in many rows , with setting name and value in each row
Table columns in these case would be
id, user_id, setting_name, setting_value

Maurício L. (Guest)
on 2009-02-13 21:16
(Received via mailing list)
It depends.

Are they complex? Are they going to change? Is it just a bunch of
"name => value" pairs?

If it's something simple, without complex values, you can just have a
string column with a Hash serialized to YAML.

Maurício Linhares (pt-br) |
pankaj (Guest)
on 2009-02-13 21:55
(Received via mailing list)
thanks Maurício,
currently all of them are binary fields about 14 of them.
More may get added later.

On Feb 14, 12:16 am, Maurício Linhares <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.