From 29b85faa2953c495fdf3b8848f3079b35de9f7d3 Mon Sep 17 00:00:00 2001 From: Sebastian Scholl <13649537+sebscholl@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:44:52 -0400 Subject: [PATCH] Update README.md The `SolidCache::Record` constant is uninitialized until after the Rails application has initialized. If not placed in an `config.after_initialize` block, the application will throw a NameError on load (Rails 7.2). --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4145c47..69e0aba 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,11 @@ You can set one of `database`, `databases` and `connects_to` in the config file. Setting `database` to `cache_db` will configure with: ```ruby -SolidCache::Record.connects_to database: { writing: :cache_db } +Rails.application.configure do + config.after_initialize do + SolidCache::Record.connects_to database: { writing: :cache_db } + end +end ``` Setting `databases` to `[cache_db, cache_db2]` is the equivalent of: