Skip to content

Commit

Permalink
Switch from ActiveSupport's on_load to railtie initializer.
Browse files Browse the repository at this point in the history
This resolves the insistent warning about errors in transactions, covered in #867.
  • Loading branch information
pat committed Dec 23, 2014
1 parent 43110fd commit 87928c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/thinking_sphinx/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class ThinkingSphinx::Railtie < Rails::Railtie
ActiveSupport.on_load :active_record do
include ThinkingSphinx::ActiveRecord::Base
initializer 'thinking_sphinx.initialisation' do
if defined?(ActiveRecord::Base)
ActiveRecord::Base.send :include, ThinkingSphinx::ActiveRecord::Base
end
end

rake_tasks do
Expand Down

0 comments on commit 87928c9

Please sign in to comment.