organizze_permanent_records 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,7 @@ module OrganizzePermanentRecords
|
|
15
15
|
base.named_scope :not_deleted, :conditions => { :deleted_at => nil }
|
16
16
|
base.instance_eval { define_callbacks :before_revive, :after_revive }
|
17
17
|
base.send :alias_method_chain, :destroy, :permanent_records
|
18
|
+
base.extend Rails2
|
18
19
|
# Early Rails code
|
19
20
|
else
|
20
21
|
base.extend EarlyRails
|
@@ -36,14 +37,23 @@ module OrganizzePermanentRecords
|
|
36
37
|
where("#{table_name}.deleted_at IS NULL")
|
37
38
|
end
|
38
39
|
end
|
39
|
-
|
40
|
-
module EarlyRails
|
41
40
|
|
41
|
+
module Rails2
|
42
42
|
def with_deleted(*args)
|
43
43
|
with_exclusive_scope do
|
44
44
|
find(*args)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module EarlyRails
|
50
|
+
|
51
|
+
def with_deleted
|
52
|
+
with_scope :find => {:conditions => "#{quoted_table_name}.deleted_at IS NOT NULL"} do
|
53
|
+
yield
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
47
57
|
|
48
58
|
def with_not_deleted
|
49
59
|
with_scope :find => {:conditions => "#{quoted_table_name}.deleted_at IS NULL"} do
|