sunspot_rails 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,11 +8,20 @@ module Sunspot #:nodoc:
8
8
  module RequestLifecycle
9
9
  class <<self
10
10
  def included(base) #:nodoc:
11
- base.after_filter do
12
- if Sunspot::Rails.configuration.auto_commit_after_request?
13
- Sunspot.commit_if_dirty
14
- elsif Sunspot::Rails.configuration.auto_commit_after_delete_request?
15
- Sunspot.commit_if_delete_dirty
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
@@ -1,5 +1,5 @@
1
1
  module Sunspot
2
2
  module Rails
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 4
9
- version: 1.0.4
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-19 00:00:00 -04:00
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
- - 4
39
- version: 1.0.4
38
+ - 5
39
+ version: 1.0.5
40
40
  type: :runtime
41
41
  version_requirements: *id001
42
42
  - !ruby/object:Gem::Dependency