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.
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Platanus
2
- VERSION = "0.1.2" # 0.2 will come with tests!
2
+ VERSION = "0.1.3" # 0.2 will come with tests!
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: platanus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: