How should we manage settings in an app? Typo, for example, has a settings table with stuff like title, subtitle, enable comments, etc. It''s basically a name for the setting and the value. Is this the best approach for settings that should be configured for the app? The majority of the time they won''t change (title), but you''d use caching in some place so you don''t take a performance hit. Anyway I''ve just been wondering the best way to allow users of an app to manage particular settings. Thanks, Pat
Pat Maddox
2005-Nov-14 07:19 UTC
Re: What''s the best way to manage settings in a Rails app?
http://wiki.rubyonrails.com/rails/pages/HowtoAddYourOwnConfigInfo gives a good description of different options. I''d like to have a nice interface to modify settings, because the end users won''t have access to the text files to modify settings themselves. Seems like using a db is the best approach? I just found out on IRC that if I use a YAML file I can easily save it by calling save on the YAML object, and it will automatically rewrite the file. Why does Typo use a db though, and what''s the best approach for me? Thanks, Pat On 11/13/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How should we manage settings in an app? Typo, for example, has a > settings table with stuff like title, subtitle, enable comments, etc. > It''s basically a name for the setting and the value. Is this the best > approach for settings that should be configured for the app? The > majority of the time they won''t change (title), but you''d use caching > in some place so you don''t take a performance hit. Anyway I''ve just > been wondering the best way to allow users of an app to manage > particular settings. > > Thanks, > Pat >
Beate Paland
2005-Nov-26 11:23 UTC
Re: Re: What''s the best way to manage settings in a Rails app?
Hi, I have to pick this up: 2005/11/14, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> I''d like to have a nice interface to modify settings, because the end > users won''t have access to the text files to modify settings > themselves. Seems like using a db is the best approach? I just found > out on IRC that if I use a YAML file I can easily save it by calling > save on the YAML object, and it will automatically rewrite the file. > Why does Typo use a db though, and what''s the best approach for me?This is also the question I wonder. Did someone already solve this in rails? TIA, Beate
Francois Beausoleil
2005-Nov-26 15:21 UTC
Re: What''s the best way to manage settings in a Rails app?
Hi ! 2005/11/14, Pat Maddox <pergesu@gmail.com>:> How should we manage settings in an app? Typo, for example, has a > settings table with stuff like title, subtitle, enable comments, etc. > It's basically a name for the setting and the value. Is this the best > approach for settings that should be configured for the app? The > majority of the time they won't change (title), but you'd use caching > in some place so you don't take a performance hit. Anyway I've just > been wondering the best way to allow users of an app to manage > particular settings.You'll have to decide for yourself what is the best approach. I have tried the two following ways: CREATE TABLE settings ( id name group_name description type str_value int_value product_id product_category_id ); and CREATE TABLE settings ( id paypal_business paypal_ipn_url ); In the first case, I have a table record per setting. Each record can be edited on a special screen I made in the application. It is basically the scaffolded list, but I replaced the value columns with a conditional partial rendering. Then, I show an HTML control depending on the type of configuration setting. In the second case, the application is just starting. I'll have a single screen where all configuration will be done. It is not done at the moment, but I will be mostly be able to regenerate it using the scaffolded edit screen. In both cases I was after a single thing: ease of backup. Backing up the DB, I have EVERYTHING - no other files need to be backed up at the same time. As I said at start, you'll need to decide for yourself which method is best for you, your team, your application and your users, in reverse order :) Have a nice day ! -- François Beausoleil http://blog.teksol.info/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails