Closed RyanNaughton closed 8 years ago
Do rake tasks still work with the settings in an initializer after the db was created?
It doesn't appear that db:create works, but the rest of the commands do.
I did some tests and found out that these configs do not work in an initializer. Rather than digging deeper into the Rails boot lifecycle for db tasks, I would like to recommend that you put them in application.rb
config.second_base.path = 'db/warehouse'
config.second_base.config_key = 'warehouse'
Once I added them there, I found it worked really well. If you can confirm the same for you, I will make a note in the projects README#configurations about it.
Sorry @metaskills, my needs for the other db were so modest and temporary, that I used what I'd learned from your blog posts, and just rolled my own that skipped active record entirely. I'm sure if it worked for you, it would have worked for me as well though.
No sweat! Fixed by d3d30a3ca979764c955fdd9fbb55498a359eb925
I am setting the configs in my initializer this way:
When I run
rake db:create
, here is the stacktrace:When I move those configs to
application.rb
it works fine:Once the DB is created, the initializer works fine when I run commands in a rails console session. Thus my guess is how the load/init process happens with the rake task and your railtie combo are the likely culprit -- just a guess though.