Skip to content
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

Don't load ActiveRecord during rails initialization #1194

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/thinking_sphinx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ module Subscribers; end
require 'thinking_sphinx/utf8'
require 'thinking_sphinx/wildcard'
# Extended
require 'thinking_sphinx/active_record'
require 'thinking_sphinx/deltas'
require 'thinking_sphinx/distributed'
require 'thinking_sphinx/logger'
require 'thinking_sphinx/real_time'

require 'thinking_sphinx/railtie' if defined?(Rails::Railtie)
if defined?(Rails::Railtie)
require 'thinking_sphinx/railtie'
else
require 'thinking_sphinx/active_record'
end

ThinkingSphinx.before_index_hooks << ThinkingSphinx::Hooks::GuardPresence
1 change: 1 addition & 0 deletions lib/thinking_sphinx/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ThinkingSphinx::Railtie < Rails::Railtie

initializer 'thinking_sphinx.initialisation' do
ActiveSupport.on_load(:active_record) do
require 'thinking_sphinx/active_record'
ActiveRecord::Base.include ThinkingSphinx::ActiveRecord::Base
end

Expand Down