semanticart-is_paranoid 0.9.3 → 0.9.4
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/CHANGELOG +3 -0
- data/VERSION.yml +1 -1
- data/is_paranoid.gemspec +2 -2
- data/lib/is_paranoid.rb +3 -3
- data/spec/is_paranoid_spec.rb +8 -0
- data/spec/models.rb +11 -1
- data/spec/schema.rb +7 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
This will only document major changes. Please see the commit log for minor changes.
|
2
2
|
|
3
|
+
-2009-09-17
|
4
|
+
* fixed when primary key was not "id" (ie: "uuid") via Thibaud Guillaume-Gentil
|
5
|
+
|
3
6
|
-2009-09-15
|
4
7
|
* added support for has_many associations (i.e. @r2d2.components_with_destroyed) via Amiel Martin
|
5
8
|
|
data/VERSION.yml
CHANGED
data/is_paranoid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{is_paranoid}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeffrey Chupp"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-17}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{jeff@semanticart.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/is_paranoid.rb
CHANGED
@@ -60,8 +60,8 @@ module IsParanoid
|
|
60
60
|
options.reverse_merge!({:include_destroyed_dependents => true}) unless options[:include]
|
61
61
|
with_exclusive_scope do
|
62
62
|
update_all(
|
63
|
-
|
64
|
-
|
63
|
+
"#{destroyed_field} = #{connection.quote(field_not_destroyed)}",
|
64
|
+
primary_key.to_sym => id
|
65
65
|
)
|
66
66
|
end
|
67
67
|
|
@@ -212,7 +212,7 @@ module IsParanoid
|
|
212
212
|
def destroy_without_callbacks
|
213
213
|
self.class.update_all(
|
214
214
|
"#{destroyed_field} = #{self.class.connection.quote(( field_destroyed.respond_to?(:call) ? field_destroyed.call : field_destroyed))}",
|
215
|
-
|
215
|
+
self.class.primary_key.to_sym => self.id
|
216
216
|
)
|
217
217
|
self
|
218
218
|
end
|
data/spec/is_paranoid_spec.rb
CHANGED
data/spec/models.rb
CHANGED
@@ -91,4 +91,14 @@ class UndestroyablePirate < ActiveRecord::Base #:nodoc:
|
|
91
91
|
def before_destroy
|
92
92
|
false
|
93
93
|
end
|
94
|
-
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class Uuid < ActiveRecord::Base #:nodoc:
|
97
|
+
set_primary_key "uuid"
|
98
|
+
|
99
|
+
def before_create
|
100
|
+
self.uuid = "295b3430-85b8-012c-cfe4-002332cf7d5e"
|
101
|
+
end
|
102
|
+
|
103
|
+
is_paranoid
|
104
|
+
end
|
data/spec/schema.rb
CHANGED
@@ -48,4 +48,11 @@ ActiveRecord::Schema.define(:version => 20090317164830) do
|
|
48
48
|
t.string "name"
|
49
49
|
t.boolean "alive", :default => true
|
50
50
|
end
|
51
|
+
|
52
|
+
create_table "uuids", :id => false, :force => true do |t|
|
53
|
+
t.string "uuid", :limit => 36, :primary => true
|
54
|
+
t.string "name"
|
55
|
+
t.datetime "deleted_at"
|
56
|
+
end
|
57
|
+
|
51
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semanticart-is_paranoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Chupp
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|