effective_logging 1.8.0 → 1.8.1
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.
- checksums.yaml +4 -4
- data/lib/effective_logging/engine.rb +6 -4
- data/lib/effective_logging/set_current_user.rb +22 -11
- data/lib/effective_logging/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45b5d90c56f4949bfb7d96bd500b4eda755c63f7
|
4
|
+
data.tar.gz: 29e1b90c42b855e6e4bfdb6eabff10a8d2d99431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
5
|
-
|
5
|
+
# Add me to your ApplicationController
|
6
|
+
# before_action :set_effective_logging_current_user
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
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
|
|