Sha256: e8712b72347f2661d2eb001b0a6a829905bbc6761d597bb7cd362894bd3815c1

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 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::Client.class_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
      
      # When loading console, make it output to STDERR.
      console do
        Sunspot::Rails::LogSubscriber.logger = Logger.new(STDERR)
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
sunspot_rails-2.7.1 lib/sunspot/rails/railtie.rb
sunspot_rails-2.7.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.6.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.5.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.4.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.3.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.8 lib/sunspot/rails/railtie.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot_rails-2.2.7/lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.7 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.6 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.5 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.4 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.3 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.2 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.1 lib/sunspot/rails/railtie.rb
sunspot_rails-2.2.0 lib/sunspot/rails/railtie.rb
sunspot_rails-2.1.1 lib/sunspot/rails/railtie.rb
sunspot_rails-2.1.0 lib/sunspot/rails/railtie.rb