on_destroy 0.1.0 → 0.1.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.
@@ -28,9 +28,7 @@ module OnDestroy
28
28
  if self.on_destroy_options
29
29
  o_set = self.on_destroy_options[:set]
30
30
  o_to = self.on_destroy_options[:to]
31
- if o_set
32
- update_attributes! o_set => (o_to.is_a?(Proc) ? o_to.call : o_to)
33
- end
31
+ update_attributes! o_set => (o_to.is_a?(Proc) ? o_to.call : o_to) unless o_set.nil?
34
32
  yield
35
33
  end
36
34
  end
@@ -58,11 +56,13 @@ module OnDestroy
58
56
  o_to = self.on_destroy_options[:to]
59
57
  if is_deleted_if.is_a?(Proc)
60
58
  send(o_set) == is_deleted_if.call
61
- elsif o_to.is_a?(Proc)
62
- # assume that a :to defined as a Proc is going to evaluate to a non-nil to indicate the model is null
63
- send(o_set) != nil
64
- else
65
- send(o_set) == o_to
59
+ elsif !(o_set.nil?)
60
+ if o_to.is_a?(Proc)
61
+ # assume that a :to defined as a Proc is going to evaluate to a non-nil to indicate the model is null
62
+ send(o_set) != nil
63
+ else
64
+ send(o_set) == o_to
65
+ end
66
66
  end
67
67
  else
68
68
  super
@@ -1,3 +1,3 @@
1
1
  module OnDestroy
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_destroy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-09 00:00:00.000000000 Z
12
+ date: 2012-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord