0

I am using Ruby on Rails 3 and I should decide definitely whether store common parameter for my application in a XML file, in a Yaml file or in the database. Currently, the database is my choice.

What I should make as parameters is something like these:

min_name_length
max_name_length
min_surname_length
max_surname_length
...

What is the best choice?

If the answer is "XML file" or "YAML file" (I think so because these approach saves a lot of database querying and loading), I must create one of those... but how to write an XML/YAML file to store common application parameters? And how to read that file located, for example', in the 'RAILS_ROOT/models' folder using Ruby on Rails?

user502052
  • 14,803
  • 30
  • 109
  • 188

1 Answers1

0

You have several different options here, but it's best to choose between file-based or database.

Database-stored settings:

I personally like the database better and use this rails3 fork of ledderman's rails-settings plugin.

It's quite simple to setup and flexible enough for my uses. You can specify your settings names, default values and it's quite straightforward.

YAML file-stored settings:

You have a detailed answer on how to keep settings in an YAML file right here on SO.

Community
  • 1
  • 1
tomeduarte
  • 2,803
  • 1
  • 17
  • 10