effective_logging 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a450d9893a3bdc765a9d509a3108afb28f367b8e
4
- data.tar.gz: 3c283840520c3676974d2f874d1b727fff8dd117
3
+ metadata.gz: 45b5d90c56f4949bfb7d96bd500b4eda755c63f7
4
+ data.tar.gz: 29e1b90c42b855e6e4bfdb6eabff10a8d2d99431
5
5
  SHA512:
6
- metadata.gz: 0efb78ee44a94a1f32f44d687707904aa5dfc41770e98777b1acf5156ce25aa18c3358b1f37312370c394e5d6560d940f1aad639fc9e09d18ef314aa06953699
7
- data.tar.gz: f50fcc75ca0eb4e8138ddae57f740773e0414789883196a01b75721b4f490091da7a7f45aecf705f5d762fdb0bdfd7e913e1ebf82ef352fd085f300f7168dec5
6
+ metadata.gz: 56e4cb39de8b526a00bae6f6bf058bce029adc2cea72c07cb9e4ee6a3504b2bb33706e9cf83232884a07175b529600fa9b2252ef14aefa90a2d2b4befb2b154a
7
+ data.tar.gz: 7511adf9b0835480625ced3d1ab7e91a6df6ed3c0245d2370f62c89bef5351f4e87e8eba5070c7376ee631a3a6f9c777263b4fa635d06e91a24e1e4fa310469f
@@ -32,11 +32,13 @@ module EffectiveLogging
32
32
  end
33
33
  end
34
34
 
35
- # Register the log_page_views concern so that it can be called in ActionController or elsewhere
35
+ # # Register the log_page_views concern so that it can be called in ActionController or elsewhere
36
36
  initializer 'effective_logging.log_changes_action_controller' do |app|
37
- ActiveSupport.on_load :action_controller do
38
- ActionController::Base.include(EffectiveLogging::SetCurrentUser)
39
- ActionController::Base.send(:before_action, :set_effective_logging_current_user)
37
+ Rails.application.config.to_prepare do
38
+ ActiveSupport.on_load :action_controller do
39
+ require 'effective_logging/set_current_user'
40
+ ActionController::Base.include(EffectiveLogging::SetCurrentUser::ActionController)
41
+ end
40
42
  end
41
43
  end
42
44
 
@@ -1,21 +1,32 @@
1
1
  module EffectiveLogging
2
2
  module SetCurrentUser
3
+ module ActionController
3
4
 
4
- # Add me to your ApplicationController
5
- # before_action :set_effective_logging_current_user
5
+ # Add me to your ApplicationController
6
+ # before_action :set_effective_logging_current_user
6
7
 
7
- def set_effective_logging_current_user
8
- if respond_to?(:current_user)
9
- EffectiveLogging.current_user = current_user
10
- else
11
- raise "(effective_logging) set_effective_logging_current_user expects a current_user() method to be available"
8
+ def set_effective_logging_current_user
9
+ if respond_to?(:current_user)
10
+ EffectiveLogging.current_user = current_user
11
+ else
12
+ raise "(effective_logging) set_effective_logging_current_user expects a current_user() method to be available"
13
+ end
12
14
  end
13
- end
14
15
 
15
- def set_log_changes_user
16
- # No longer need to call this
17
- end
16
+ def set_log_changes_user
17
+ # No longer need to call this
18
+ end
18
19
 
20
+ # Sets the before action it immediately
21
+ def self.included(base)
22
+ if base.respond_to?(:before_action)
23
+ base.before_action :set_effective_logging_current_user
24
+ else
25
+ base.before_filter :set_effective_logging_current_user
26
+ end
27
+ end
28
+
29
+ end
19
30
  end
20
31
  end
21
32
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '1.8.0'.freeze
2
+ VERSION = '1.8.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect