Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to manage Rails application configuration settings persisted in a database? [closed]

I was hoping someone could suggest some best practices for configuring Rails applications using a database (i.e. persisting configuration settings to a database rather than a flat file). My reasoning for this is that I have an application that will run on multiple servers and there are some configuration settings that are fairly dynamic and I would want to change them without having to make a change on every server.

In other languages, I've seen this done by using a simple configuration table (like name/value pairs) and a singleton that exposes the configuration data and periodically gets refreshed. Is there a similar - or better - way to do this with Rails?

Thanks in advance.

like image 572
Chris Hart Avatar asked Nov 05 '22 10:11

Chris Hart


2 Answers

Not the prettiest solution I'm sure, but one thing we've done for our internal apps is create a 'config' field that is simply a text field containing a serialized hash. Then we deserialize on load from the db.

like image 172
rainkinz Avatar answered Nov 11 '22 02:11

rainkinz


https://github.com/Squeegy/rails-settings

like image 33
Giovanni Cappellotto Avatar answered Nov 11 '22 04:11

Giovanni Cappellotto