Sha256: 7bf2aac5f3f192d40360a12d9e33cf770c8c833087e450442d22c510a4825443

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

require 'thinking_sphinx'
require 'rails'

module ThinkingSphinx
  class Railtie < Rails::Railtie

    initializer 'thinking_sphinx.sphinx' do
      ThinkingSphinx::AutoVersion.detect
    end

    initializer "thinking_sphinx.active_record" do
      ActiveSupport.on_load :active_record do
        include ThinkingSphinx::ActiveRecord
      end
    end

    initializer "thinking_sphinx.action_controller" do
      ActiveSupport.on_load :action_controller do
        require 'thinking_sphinx/action_controller'
        include ThinkingSphinx::ActionController
      end
    end

    initializer "thinking_sphinx.set_app_root" do |app|
      ThinkingSphinx::Configuration.instance.reset # Rails has setup app now
    end

    config.to_prepare do
      # ActiveRecord::Base.to_crc32s is dependant on the subclasses being loaded
      # consistently. When the environment is reset, subclasses/descendants will
      # be lost but our context will not reload them for us.
      #
      # We reset the context which causes the subclasses/descendants to be
      # reloaded next time the context is called.
      #
      ThinkingSphinx.reset_context!
    end

    rake_tasks do
      load File.expand_path('../tasks.rb', __FILE__)
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
friendlyfashion-thinking-sphinx-2.0.14.4 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.14.3 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.1.0 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.14.2 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.14.1 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.14 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.13.3 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.13.2 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.13.1 lib/thinking_sphinx/railtie.rb
friendlyfashion-thinking-sphinx-2.0.13 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.13 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.12 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.11 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.10 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.9 lib/thinking_sphinx/railtie.rb
thinking-sphinx-2.0.8 lib/thinking_sphinx/railtie.rb