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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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) On Fri, Feb 13, 2009 at 4:12 PM, pankaj <pankajbhageria-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 Linhareshttp://alinhavado.wordpress.com/(pt-br) |http://blog.codevader.com/(en) > > On Fri, Feb 13, 2009 at 4:12 PM, pankaj <pankajbhage...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---