Sha256: baba36cb7b4f42e2496688162bcfca31e938ac51be63d97a357eba847fe11501

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

module Sunspot
  module Rails
    class Railtie < ::Rails::Railtie
      initializer 'sunspot_rails.init', :before=> :load_config_initializers do
        Sunspot.session = Sunspot::Rails.build_session
        ActiveSupport.on_load(:active_record) do
          Sunspot::Adapters::InstanceAdapter.register(Sunspot::Rails::Adapters::ActiveRecordInstanceAdapter, ActiveRecord::Base)
          Sunspot::Adapters::DataAccessor.register(Sunspot::Rails::Adapters::ActiveRecordDataAccessor, ActiveRecord::Base)
          include(Sunspot::Rails::Searchable)
        end
        ActiveSupport.on_load(:action_controller) do
          include(Sunspot::Rails::RequestLifecycle)
        end
        require 'sunspot/rails/log_subscriber'
        RSolr::Connection.module_eval{ include Sunspot::Rails::SolrInstrumentation }
      end

      # Expose database runtime to controller for logging.
      initializer "sunspot_rails.log_runtime" do |app|
        require "sunspot/rails/railties/controller_runtime"
        ActiveSupport.on_load(:action_controller) do
          include Sunspot::Rails::Railties::ControllerRuntime
        end
      end

      rake_tasks do
        load 'sunspot/rails/tasks.rb'
      end
      
      generators do
        load "generators/sunspot_rails.rb"
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sunspot_rails-2.0.0.pre.120720 lib/sunspot/rails/railtie.rb
sunspot_rails-1.3.3 lib/sunspot/rails/railtie.rb
sunspot_rails-1.3.2 lib/sunspot/rails/railtie.rb
sunspot_rails-2.0.0.pre.120417 lib/sunspot/rails/railtie.rb
sunspot_rails-2.0.0.pre.120415 lib/sunspot/rails/railtie.rb