Generate reference to the database in the cache template for all envi…#279
Conversation
|
I agree, not having |
|
Thanks for the PR @orbanbotond! As @AliSepehri says we'd need to change the default database.yml in Rails for this to work out of the box. But I don't think that's likely to happen - the default behavior is to stick to an in memory database that works out of the box without having to update the schema. But I think this change is still useful - it means that when you set |
| namespace: <%%= Rails.env %> | ||
|
|
||
| development: | ||
| database: <%= ENV.fetch("DATABASE", "cache") %> |
There was a problem hiding this comment.
I don't think we should be defaulting to the DATABASE value. The cache is expected to use a different database to the app.
I think we should just have database: cache and move it up to the defaults so we don't need to set it individually for development/test/production.
There was a problem hiding this comment.
Oh sorry <%= ENV.fetch("DATABASE", "cache") %> is what we want - this is the template not the final output!
It does not work out of the box in See #291 for details with repro steps. |
|
Thanks @jeromedalbert, I'll revert and release 1.0.10 for now and take a closer look next week |
|
Thank you so much for the extremely quick response @djmb! And sorry for being a Debbie Downer. 😅 |
Fix #278
The problem:
When we run the bundle exec rails solid_cache:install, it generated a cache.yml file which contains the reference to the cache database only for production mode.
(Personal Note: As I was testing the cache in development, I was expecting that the generated file would be perfect for all environments. Then I would turn on the caching for the development environment in the development.rb by config.cache_store = :solid_cache_store if I wanted to. But I was surprised. My eyes just jumped over the missing
database:...part in the cache.yml file, so I spent about 20 minutes figuring out what was wrong. If we multiply that 20 minutes by 10000 devs who are struggling, then that is a lot of lost hours ~3300)The solution:
Generate a ready-to-use cache file.
This decision is up to you (37signal) guys :) I just want to be helpful.
Some other guys were also struggling with this issue:
https://www.reddit.com/r/rails/comments/1gws1fp/help_needed_with_solid_cache/