diff options
author | Eileen Uchitelle <eileencodes@gmail.com> | 2018-09-12 10:09:59 -0400 |
---|---|---|
committer | Eileen Uchitelle <eileencodes@gmail.com> | 2018-09-12 10:09:59 -0400 |
commit | 349db176d8283a5c16816b50a92b0b319b1b8b74 (patch) | |
tree | f80a85ef9868212d9ad3b243f9233a7ebecb9e9d /activerecord | |
parent | 3eb0406ef56dab8c8cd60378600a53e351de0053 (diff) | |
download | rails-349db176d8283a5c16816b50a92b0b319b1b8b74.tar.gz rails-349db176d8283a5c16816b50a92b0b319b1b8b74.tar.bz2 rails-349db176d8283a5c16816b50a92b0b319b1b8b74.zip |
Fix query cache to load before first request
In a test app we observed that the query cache was not enabled on the
first request. This was because the query cache hooks are installed on
load and active record is loaded in the middle of the first request.
If we remove the `on_load` from the railtie the query cache hooks will
be installed before the first request, allowing the cache to be enabled
on that first request.
This is ok because query cache doesn't load anything else, only itself
so we're not eager loading all of active record before the first
request, just the query cache hooks.
[Eileen M. Uchitelle & Matthew Draper]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 47351588d3..b213754641 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -180,9 +180,7 @@ end_warning end initializer "active_record.set_executor_hooks" do - ActiveSupport.on_load(:active_record) do - ActiveRecord::QueryCache.install_executor_hooks - end + ActiveRecord::QueryCache.install_executor_hooks end initializer "active_record.add_watchable_files" do |app| |