acts_as_removable 1.0.0 → 1.1.0
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/acts_as_removable.rb +14 -12
- data/lib/acts_as_removable/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca8b02fea9945ffb1dd7187efafbe16fd788dc6
|
4
|
+
data.tar.gz: b98900fca9e10a29296ca8efd5bf2deb62695797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1669f514ae58f35ee1bb4d1a1e9f3329381c4ef1a24efe6eef1b5ed8ce7bb97c99bec40a4eba31b362ed13459718a7482b97f099933bf64acdd00d83fe64ed4
|
7
|
+
data.tar.gz: 3a1704d88c080ecc6420f9e754ae66489c4c0a8374662ff6e3e61f65fd773b879197ea78a101fe1aee9898d7fcf8fda1a6f674abc68cacc07d878108c7aef098
|
data/lib/acts_as_removable.rb
CHANGED
@@ -37,45 +37,47 @@ module ActsAsRemovable
|
|
37
37
|
|
38
38
|
class_eval do
|
39
39
|
def self.before_remove(*args, &block)
|
40
|
-
set_callback
|
40
|
+
set_callback(:remove, :before, *args, &block)
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.after_remove(*args, &block)
|
44
|
-
set_callback
|
44
|
+
set_callback(:remove, :after, *args, &block)
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.before_unremove(*args, &block)
|
48
|
-
set_callback
|
48
|
+
set_callback(:unremove, :before, *args, &block)
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.after_unremove(*args, &block)
|
52
|
-
set_callback
|
52
|
+
set_callback(:unremove, :after, *args, &block)
|
53
53
|
end
|
54
54
|
|
55
55
|
def removed?
|
56
56
|
send(self.class._acts_as_removable_options[:column_name]).present?
|
57
57
|
end
|
58
58
|
|
59
|
-
def remove(options={})
|
59
|
+
def remove(options = {})
|
60
60
|
_update_remove_attribute(:remove, Time.now, false, options)
|
61
61
|
end
|
62
62
|
|
63
|
-
def remove!(options={})
|
63
|
+
def remove!(options = {})
|
64
64
|
_update_remove_attribute(:remove, Time.now, true, options)
|
65
65
|
end
|
66
66
|
|
67
|
-
def unremove(options={})
|
67
|
+
def unremove(options = {})
|
68
68
|
_update_remove_attribute(:unremove, nil, false, options)
|
69
69
|
end
|
70
70
|
|
71
|
-
def unremove!(options={})
|
71
|
+
def unremove!(options = {})
|
72
72
|
_update_remove_attribute(:unremove, nil, true, options)
|
73
73
|
end
|
74
74
|
|
75
|
-
def _update_remove_attribute(callback, value, with_bang=false, options={})
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
def _update_remove_attribute(callback, value, with_bang = false, options = {})
|
76
|
+
self.class.transaction do
|
77
|
+
run_callbacks callback.to_sym do
|
78
|
+
send("#{self.class._acts_as_removable_options[:column_name]}=", value)
|
79
|
+
with_bang ? save!(options) : save(options)
|
80
|
+
end
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_removable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -134,10 +134,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.4.
|
137
|
+
rubygems_version: 2.4.6
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Simplifies handling of pseudo removed records
|
141
141
|
test_files:
|
142
142
|
- spec/acts_as_removable_spec.rb
|
143
143
|
- spec/spec_helper.rb
|
144
|
+
has_rdoc:
|