0

What is the best practice for storing non-tabular settings (configured by the end-user) for the application?

I know it is possible by creating a model and using it, but creating a one-row-table in the database seems a little wasteful to me.

4

1 回答 1

3

将数据转换为 YAML,并将其写入配置文件。

require "yaml"

File.write(path_to_configuration_file, YAML.dump(obj)) # write

obj = YAML.load_file(path_to_configuration_file) # read
于 2013-08-26T11:25:16.940 回答