spring
spring copied to clipboard
Possible to spring rake tasks only when loading environment?
I'm wondering if it might be possible to use the spring preloader only when running tasks that declare an => :environment
dependency.
I'm running into problems with an app that tries to establish a database connection in initializers, and fails when running rake db:setup
because the preloader tries to get in front of creating the database. (Obviously one workaround is to use DISABLE_SPRING
...)
I realize that some commands such as rake -T
may also benefit from preloading since getting the list of engine-defined tasks depends on loading the environment...
Any thoughts on whether there's a possible approach to this? I might investigate if it makes sense.