Forum: Ruby on Rails Storing user specific settings

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A40f08a2dfcbf7feab0c9bc063c01f9c?d=identicon&s=25 pankaj (Guest)
on 2009-02-13 20: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

 or

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


Regards,
Pankaj
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-02-13 20: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
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
A40f08a2dfcbf7feab0c9bc063c01f9c?d=identicon&s=25 pankaj (Guest)
on 2009-02-13 20: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 <mauricio.linha...@gmail.com>
This topic is locked and can not be replied to.