sunspot_rails 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sunspot/rails/request_lifecycle.rb +14 -5
- data/lib/sunspot/rails/version.rb +1 -1
- metadata +5 -5
@@ -8,11 +8,20 @@ module Sunspot #:nodoc:
|
|
8
8
|
module RequestLifecycle
|
9
9
|
class <<self
|
10
10
|
def included(base) #:nodoc:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
loaded_controllers =
|
12
|
+
[base].concat(base.subclasses.map { |subclass| subclass.constantize })
|
13
|
+
# Depending on how Sunspot::Rails is loaded, there may already be
|
14
|
+
# controllers loaded into memory that subclass this controller. In
|
15
|
+
# this case, since after_filter uses the inheritable_attribute
|
16
|
+
# structure, the already-loaded subclasses don't get the filters. So,
|
17
|
+
# the below ensures that all loaded controllers have the filter.
|
18
|
+
loaded_controllers.each do |controller|
|
19
|
+
controller.after_filter do
|
20
|
+
if Sunspot::Rails.configuration.auto_commit_after_request?
|
21
|
+
Sunspot.commit_if_dirty
|
22
|
+
elsif Sunspot::Rails.configuration.auto_commit_after_delete_request?
|
23
|
+
Sunspot.commit_if_delete_dirty
|
24
|
+
end
|
16
25
|
end
|
17
26
|
end
|
18
27
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 5
|
9
|
+
version: 1.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mat Brown
|
@@ -22,7 +22,7 @@ autorequire:
|
|
22
22
|
bindir: bin
|
23
23
|
cert_chain: []
|
24
24
|
|
25
|
-
date: 2010-03-
|
25
|
+
date: 2010-03-22 00:00:00 -04:00
|
26
26
|
default_executable:
|
27
27
|
dependencies:
|
28
28
|
- !ruby/object:Gem::Dependency
|
@@ -35,8 +35,8 @@ dependencies:
|
|
35
35
|
segments:
|
36
36
|
- 1
|
37
37
|
- 0
|
38
|
-
-
|
39
|
-
version: 1.0.
|
38
|
+
- 5
|
39
|
+
version: 1.0.5
|
40
40
|
type: :runtime
|
41
41
|
version_requirements: *id001
|
42
42
|
- !ruby/object:Gem::Dependency
|