acts_as_pack_rat 1.0.1 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/acts_as_pack_rat.rb +12 -7
- data/lib/tasks/rubyforge_config.yml +1 -1
- metadata +3 -2
data/lib/acts_as_pack_rat.rb
CHANGED
@@ -2,13 +2,14 @@ class ActiveRecord::Base
|
|
2
2
|
|
3
3
|
class << self
|
4
4
|
|
5
|
+
[:find, :count, :sum, :calculate, :average, :minimum, :maximum].each do |m|
|
6
|
+
alias_method "#{m}_with_deleted", m
|
7
|
+
end
|
8
|
+
|
5
9
|
def acts_as_pack_rat
|
6
|
-
alias_method :destroy_without_callbacks!, :destroy_without_callbacks
|
7
|
-
class << self
|
8
|
-
[:find, :count, :sum, :calculate, :average, :minimum, :maximum].each do |m|
|
9
|
-
alias_method "#{m}_with_deleted", m
|
10
|
-
end
|
11
10
|
|
11
|
+
class << self
|
12
|
+
|
12
13
|
[:find, :count].each do |m|
|
13
14
|
eval %{
|
14
15
|
def #{m}(*args)
|
@@ -40,7 +41,7 @@ class ActiveRecord::Base
|
|
40
41
|
class_eval do
|
41
42
|
def destroy
|
42
43
|
unless new_record?
|
43
|
-
|
44
|
+
puts "acts_as_pack_rat: destroy"
|
44
45
|
return false if callback(:before_destroy) == false
|
45
46
|
if self.respond_to?(:status_id)
|
46
47
|
self.status = Status.deleted
|
@@ -49,7 +50,7 @@ class ActiveRecord::Base
|
|
49
50
|
end
|
50
51
|
result = self.send(:update_without_callbacks)
|
51
52
|
callback(:after_destroy)
|
52
|
-
freeze
|
53
|
+
# freeze
|
53
54
|
return result
|
54
55
|
end
|
55
56
|
end
|
@@ -57,6 +58,10 @@ class ActiveRecord::Base
|
|
57
58
|
def destroy!
|
58
59
|
ar_destroy
|
59
60
|
end
|
61
|
+
|
62
|
+
def pack_rat?
|
63
|
+
true
|
64
|
+
end
|
60
65
|
|
61
66
|
end
|
62
67
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: acts_as_pack_rat
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.5
|
7
|
+
date: 2007-12-12 00:00:00 -05:00
|
8
8
|
summary: acts_as_pack_rat
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -17,6 +17,7 @@ rubyforge_project: magrathea
|
|
17
17
|
description: "acts_as_pack_rat was developed by: markbates"
|
18
18
|
autorequire:
|
19
19
|
- acts_as_pack_rat
|
20
|
+
- acts_as_pack_rat
|
20
21
|
default_executable:
|
21
22
|
bindir: bin
|
22
23
|
has_rdoc: false
|