acts_as_trashable 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -8
- data/VERSION +1 -1
- data/acts_as_trashable.gemspec +21 -23
- data/lib/acts_as_trashable/trash_record.rb +6 -3
- data/spec/spec_helper.rb +7 -0
- metadata +10 -11
- data/.gitignore +0 -1
data/Rakefile
CHANGED
@@ -6,14 +6,13 @@ desc 'Default: run unit tests.'
|
|
6
6
|
task :default => :test
|
7
7
|
|
8
8
|
begin
|
9
|
-
require '
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
require 'rspec'
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
desc 'Run the unit tests'
|
12
|
+
RSpec::Core::RakeTask.new(:test)
|
14
13
|
rescue LoadError
|
15
|
-
|
16
|
-
STDERR.puts "You must have rspec
|
14
|
+
task :test do
|
15
|
+
STDERR.puts "You must have rspec 2.0 installed to run the tests"
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -38,7 +37,7 @@ begin
|
|
38
37
|
|
39
38
|
gem.add_dependency('activerecord', '>= 2.2')
|
40
39
|
gem.add_development_dependency('sqlite3')
|
41
|
-
gem.add_development_dependency('rspec', '>=
|
40
|
+
gem.add_development_dependency('rspec', '>= 2.0.0')
|
42
41
|
gem.add_development_dependency('jeweler')
|
43
42
|
end
|
44
43
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/acts_as_trashable.gemspec
CHANGED
@@ -1,65 +1,63 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_trashable}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Durand"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-08}
|
13
13
|
s.description = %q{ActiveRecord extension that serializes destroyed records into a trash table from which they can be restored. This is intended to reduce the risk of users misusing your application's delete function and losing data.}
|
14
14
|
s.email = %q{brian@embellishedvisions.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"spec/trash_record_spec.rb"
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"acts_as_trashable.gemspec",
|
24
|
+
"lib/acts_as_trashable.rb",
|
25
|
+
"lib/acts_as_trashable/trash_record.rb",
|
26
|
+
"spec/acts_as_trashable_spec.rb",
|
27
|
+
"spec/full_spec.rb",
|
28
|
+
"spec/spec_helper.rb",
|
29
|
+
"spec/trash_record_spec.rb"
|
31
30
|
]
|
32
31
|
s.homepage = %q{http://github.com/bdurand/acts_as_trashable}
|
33
32
|
s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
|
34
33
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.
|
34
|
+
s.rubygems_version = %q{1.4.1}
|
36
35
|
s.summary = %q{ActiveRecord extension that serializes destroyed records into a trash table from which they can be restored.}
|
37
36
|
s.test_files = [
|
38
37
|
"spec/acts_as_trashable_spec.rb",
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
"spec/full_spec.rb",
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"spec/trash_record_spec.rb"
|
42
41
|
]
|
43
42
|
|
44
43
|
if s.respond_to? :specification_version then
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
44
|
s.specification_version = 3
|
47
45
|
|
48
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
47
|
s.add_runtime_dependency(%q<activerecord>, [">= 2.2"])
|
50
48
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
51
|
-
s.add_development_dependency(%q<rspec>, [">=
|
49
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
52
50
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
53
51
|
else
|
54
52
|
s.add_dependency(%q<activerecord>, [">= 2.2"])
|
55
53
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
56
|
-
s.add_dependency(%q<rspec>, [">=
|
54
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
57
55
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
58
56
|
end
|
59
57
|
else
|
60
58
|
s.add_dependency(%q<activerecord>, [">= 2.2"])
|
61
59
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
62
|
-
s.add_dependency(%q<rspec>, [">=
|
60
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
63
61
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
64
62
|
end
|
65
63
|
end
|
@@ -56,12 +56,15 @@ module ActsAsTrashable
|
|
56
56
|
def restore
|
57
57
|
restore_class = self.trashable_type.constantize
|
58
58
|
|
59
|
-
# Check if we have a type field, if yes, assume single table inheritance and restore the actual class instead of the stored base class
|
60
59
|
sti_type = self.trashable_attributes[restore_class.inheritance_column]
|
61
60
|
if sti_type
|
62
61
|
begin
|
63
|
-
restore_class
|
64
|
-
|
62
|
+
if !restore_class.store_full_sti_class && !sti_type.start_with?("::")
|
63
|
+
sti_type = "#{restore_class.parent.name}::#{sti_type}"
|
64
|
+
end
|
65
|
+
restore_class = sti_type.constantize
|
66
|
+
rescue NameError => e
|
67
|
+
raise e
|
65
68
|
# Seems our assumption was wrong and we have no STI
|
66
69
|
end
|
67
70
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_trashable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Durand
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-08 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -55,12 +55,12 @@ dependencies:
|
|
55
55
|
requirements:
|
56
56
|
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
58
|
+
hash: 15
|
59
59
|
segments:
|
60
|
-
-
|
61
|
-
-
|
60
|
+
- 2
|
61
|
+
- 0
|
62
62
|
- 0
|
63
|
-
version:
|
63
|
+
version: 2.0.0
|
64
64
|
type: :development
|
65
65
|
version_requirements: *id003
|
66
66
|
- !ruby/object:Gem::Dependency
|
@@ -86,7 +86,6 @@ extensions: []
|
|
86
86
|
extra_rdoc_files:
|
87
87
|
- README.rdoc
|
88
88
|
files:
|
89
|
-
- .gitignore
|
90
89
|
- MIT-LICENSE
|
91
90
|
- README.rdoc
|
92
91
|
- Rakefile
|
@@ -130,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
129
|
requirements: []
|
131
130
|
|
132
131
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 1.4.1
|
134
133
|
signing_key:
|
135
134
|
specification_version: 3
|
136
135
|
summary: ActiveRecord extension that serializes destroyed records into a trash table from which they can be restored.
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
pkg
|