Consider improving application settings
In past we had some errors with application settings. People create migrations to add new column to application_settings
table, and sometimes forget about default value, sometimes it is difficult or impossible to add default value to database column.
Currently we do not have mechanism to fallback to default value configured in create_from_defaults
method, therefore we sometimes run into unexpected nil
values, which cause exceptions.
We should improve ApplicationSetting
model to prevent such problems in the future. We can consider few approaches, like using default setting if database entry is nil
(we can override _read_attribute
to achieve this), or we can go for more object oriented design, where each setting has a separate class, that takes persistence model in an initializer and implements it's own default values (this is solution that seems interesting for me).
Another ideas appreciated.
/cc @rspeicher @DouweM @ayufan