platanus 0.1.2 → 0.1.3
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/platanus/gcontroller.rb +1 -1
- data/lib/platanus/traceable.rb +8 -8
- data/lib/platanus/version.rb +1 -1
- metadata +1 -1
data/lib/platanus/gcontroller.rb
CHANGED
@@ -21,6 +21,6 @@ class ActionController::Base
|
|
21
21
|
# * *Raises* :
|
22
22
|
# - +Platanus::NotInRequestError+ -> If current controller instance is not avaliable.
|
23
23
|
def self.current
|
24
|
-
Thread.current[:controller] || (raise Platanus::NotInRequestError, 'Current controller not loaded')
|
24
|
+
Thread.current[:controller] # || (raise Platanus::NotInRequestError, 'Current controller not loaded')
|
25
25
|
end
|
26
26
|
end
|
data/lib/platanus/traceable.rb
CHANGED
@@ -37,38 +37,38 @@ module Platanus
|
|
37
37
|
|
38
38
|
def __trace_create # :nodoc:
|
39
39
|
controller = ActionController::Base.current
|
40
|
-
if controller.respond_to? :trace_user_id and self.respond_to? :created_by=
|
40
|
+
if controller and controller.respond_to? :trace_user_id and self.respond_to? :created_by=
|
41
41
|
self.created_by = controller.trace_user_id
|
42
42
|
end
|
43
43
|
yield
|
44
|
-
controller.trace(:create, self) if controller.respond_to? :trace
|
44
|
+
controller.trace(:create, self) if controller and controller.respond_to? :trace
|
45
45
|
end
|
46
46
|
|
47
47
|
def __trace_update # :nodoc:
|
48
48
|
controller = ActionController::Base.current
|
49
|
-
if controller.respond_to? :trace_user_id and self.respond_to? :updated_by=
|
49
|
+
if controller and controller.respond_to? :trace_user_id and self.respond_to? :updated_by=
|
50
50
|
self.updated_by = controller.trace_user_id
|
51
51
|
end
|
52
52
|
yield
|
53
|
-
controller.trace(:update, self) if controller.respond_to? :trace
|
53
|
+
controller.trace(:update, self) if controller and controller.respond_to? :trace
|
54
54
|
end
|
55
55
|
|
56
56
|
def __trace_destroy # :nodoc:
|
57
57
|
controller = ActionController::Base.current
|
58
|
-
if controller.respond_to? :trace_user_id and self.respond_to? :destroyed_by=
|
58
|
+
if controller and controller.respond_to? :trace_user_id and self.respond_to? :destroyed_by=
|
59
59
|
self.destroyed_by = controller.trace_user_id
|
60
60
|
end
|
61
61
|
yield
|
62
|
-
controller.trace(:destroy, self) if controller.respond_to? :trace
|
62
|
+
controller.trace(:destroy, self) if controller and controller.respond_to? :trace
|
63
63
|
end
|
64
64
|
|
65
65
|
def __trace_remove # :nodoc:
|
66
66
|
controller = ActionController::Base.current
|
67
|
-
if controller.respond_to? :trace_user_id and self.respond_to? :removed_by=
|
67
|
+
if controller and controller.respond_to? :trace_user_id and self.respond_to? :removed_by=
|
68
68
|
self.removed_by = controller.trace_user_id
|
69
69
|
end
|
70
70
|
yield
|
71
|
-
controller.trace(:remove, self) if controller.respond_to? :trace
|
71
|
+
controller.trace(:remove, self) if controller and controller.respond_to? :trace
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/platanus/version.rb
CHANGED