diff --git a/lib/thinking_sphinx.rb b/lib/thinking_sphinx.rb index 15bc37d4..2e59e8c6 100644 --- a/lib/thinking_sphinx.rb +++ b/lib/thinking_sphinx.rb @@ -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 diff --git a/lib/thinking_sphinx/railtie.rb b/lib/thinking_sphinx/railtie.rb index 8ba1f858..bc9efd36 100644 --- a/lib/thinking_sphinx/railtie.rb +++ b/lib/thinking_sphinx/railtie.rb @@ -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