Sha256: 224e631da3945bcfd027dfc899d2c05ef5bfa5b268cf5f14c2acb42933e16664

Contents?: true

Size: 674 Bytes

Versions: 12

Compression:

Stored size: 674 Bytes

Contents

module Sunspot #:nodoc:
  module Rails #:nodoc:
    # 
    # This module adds an after_filter to ActionController::Base that commits
    # the Sunspot session if any documents have been added, changed, or removed
    # in the course of the request.
    #
    module RequestLifecycle
      class <<self
        def included(base) #:nodoc:
          base.after_filter do
            if Sunspot::Rails.configuration.auto_commit_after_request?
              Sunspot.commit_if_dirty
            elsif Sunspot::Rails.configuration.auto_commit_after_delete_request?
              Sunspot.commit_if_delete_dirty
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
sunspot_rails-1.0.4 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-1.0.3 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-1.0.2 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-1.0.1 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-1.0.0 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.5 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.4 lib/sunspot/rails/request_lifecycle.rb
nxa-sunspot_rails-0.11.3 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.3 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.2 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.1 lib/sunspot/rails/request_lifecycle.rb
sunspot_rails-0.11.0 lib/sunspot/rails/request_lifecycle.rb