Closed sandipagarwal closed 4 years ago
Hi, @sandipagarwal! Thank you for your contribution. Could you please explain the reasoning and use case behind this new rake task?
Invoking
Setting.load_defaults(false)
will not update the values for any settings. It will solely create new/destroy settings that have been added/removed from thesail.yml
file. However, this already happens during boot time in a Sail initializer, so I'm not sure when this task would be used.If you updated the contents of
sail.yml
and need to reflect it in the database, then you should userake sail:load_defaults
, which will re-create all settings with the new configurations.
Hi @vinistock, I understand the settings are reflected at boot time, but as a dev, I want this to reflect w/o restarting my app/docker. Hence, this helps me fire a rake task that does the work for me.
@sandipagarwal I'm having a hard time understanding the exact scenario in which you would need this.
When you invoke Setting.load_defaults(false)
, it will not update the values for settings. It compares the entries in config/sail.yml
and the settings in the database. If new items were added in the file, they are created in the database. If items were removed from the file, they are removed from the database.
There are only two cases in which this rake task would actually do something (please help me understand exactly what you are doing in your app):
config/sail.yml
changed. If they have changed, that means you are deploying and the app is going to be rebooted anyway.And again, if you just need a full reset of your database you can invoke rake sail:load_defaults
.
Hi, @sandipagarwal! Thank you for your contribution. Could you please explain the reasoning and use case behind this new rake task?
Invoking
Setting.load_defaults(false)
will not update the values for any settings. It will solely create new/destroy settings that have been added/removed from thesail.yml
file. However, this already happens during boot time in a Sail initializer, so I'm not sure when this task would be used.If you updated the contents of
sail.yml
and need to reflect it in the database, then you should userake sail:load_defaults
, which will re-create all settings with the new configurations.