-
Notifications
You must be signed in to change notification settings - Fork 76
Generate reference to the database in the cache template for all envi… #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/