Closed jclusso closed 3 months ago
This is not a simple_form thing, it's a Rails thing. Any time you change a file in config/initializers/ you have to restart rails.
There may be a way e.g. add the following to the top of your controller:
SimpleForm.setup do |config|
config.button_class = 'btn btn-info'
end
This should autoload and then you can move this to your initializer when you have finished any changes.
I unfortunately don't think it is possible. I tried to play with the options in the Rails guide but I think it actually doesn't apply here. The problem seems to be that code in the Rails initializers does not get reloaded and none of the options make it reloadable. To me the most promising was the to_prepare
block but this also is a callback that allows just a (static / not reloaded) code in the initializer to configure some other reloadable code.
Without moving the configuration to some other place that would get reloaded, this seems not feasible.
Yeah, it might be inconvenient when you write your wrapper configuration (but @btrewern proposed a good alternative for this case, also you could probably look into something like https://avohq.io/blog/auto-reload-rails-initializers-and-other-files-in-development). But when wrapper configuration part if done you rarely need to update your SimpleForm config.
When developing with Simple Form + Tailwind, I've found it extremely painful that you have to restart your server between every adjustment to the configuration. I was wondering if there is any reason we don't have some sort of auto reloading in development?