acts_as_paranoid 0.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ *0.3.1* (20 Dec 2005)
2
+
3
+ * took out deleted association code for 'chainsaw butchery of base classes' [sorry Erik Terpstra]
4
+ * verified tests pass on Rails 1.0
5
+
6
+ *0.3* (27 Nov 2005)
7
+
8
+ * Deleted models will find deleted associations by default now [Erik Terpstra]
9
+ * Added :group as valid option for find [Michael Dabney]
10
+ * Changed the module namespace to Caboose::Acts::Paranoid
11
+
1
12
  *0.2.0* (6 Nov 2005)
2
13
 
3
14
  * Upgrade to Rails 1.0 RC4. ActiveRecord::Base#constrain has been replaced with scope_with.
@@ -1,4 +1,4 @@
1
- module ActiveRecord #:nodoc:
1
+ module Caboose #:nodoc:
2
2
  module Acts #:nodoc:
3
3
  # Overrides some basic methods for the current model so that calling #destroy sets a 'deleted_at' field to the current timestamp.
4
4
  # This assumes the table has a deleted_at date/time field. Most normal model operations will work, but there will be some oddities.
@@ -33,124 +33,134 @@ module ActiveRecord #:nodoc:
33
33
  #
34
34
  # @widget.destroy!
35
35
  # # DELETE FROM widgets WHERE id = 1
36
+ #
36
37
  module Paranoid
37
- def self.included(base) # :nodoc:
38
- base.extend ClassMethods
39
- end
40
-
41
- module ClassMethods
42
- def acts_as_paranoid
43
- unless self.included_modules.include?(ParanoidMethods) # don't let AR call this twice
44
- alias_method :destroy_without_callbacks!, :destroy_without_callbacks
45
- class << self
46
- alias_method :original_find, :find
47
- alias_method :count_with_deleted, :count
48
- alias_method :clobbering_with_scope, :with_scope
49
- end
50
- end
51
- include ParanoidMethods
52
- end
53
- end
54
-
55
- module ParanoidMethods #:nodoc:
38
+ module ActiveRecord
56
39
  def self.included(base) # :nodoc:
57
40
  base.extend ClassMethods
41
+ class << base
42
+ alias_method :validate_find_options_without_deleted, :validate_find_options
43
+ alias_method :validate_find_options, :validate_find_options_with_deleted
44
+ end
58
45
  end
59
-
46
+
60
47
  module ClassMethods
61
- def find(*args)
62
- options = extract_options_from_args!(args)
63
- call_original_find = lambda { original_find(*(args << options)) }
64
-
65
- if !options[:with_deleted]
66
- with_deleted_scope { return call_original_find.call }
48
+ def acts_as_paranoid
49
+ unless paranoid? # don't let AR call this twice
50
+ alias_method :destroy_without_callbacks!, :destroy_without_callbacks
51
+ class << self
52
+ alias_method :original_find, :find
53
+ alias_method :count_with_deleted, :count
54
+ alias_method :clobbering_with_scope, :with_scope
55
+ end
67
56
  end
68
-
69
- call_original_find.call
57
+ include InstanceMethods
70
58
  end
71
-
72
- def find_with_deleted(*args)
73
- original_find(*(args << extract_options_from_args!(args).merge(:with_deleted => true)))
59
+
60
+ def paranoid?
61
+ self.included_modules.include?(InstanceMethods)
74
62
  end
75
-
76
- def count(conditions = nil, joins = nil)
77
- with_deleted_scope { count_with_deleted(conditions, joins) }
63
+
64
+ protected
65
+ def validate_find_options_with_deleted(options)
66
+ options.assert_valid_keys [:conditions, :group, :include, :joins, :limit, :offset, :order, :select, :readonly, :with_deleted]
67
+ end
68
+ end
69
+
70
+ module InstanceMethods #:nodoc:
71
+ def self.included(base) # :nodoc:
72
+ base.extend ClassMethods
78
73
  end
74
+
75
+ module ClassMethods
76
+ def find(*args)
77
+ options = extract_options_from_args!(args)
78
+ call_original_find = lambda { original_find(*(args << options)) }
79
+
80
+ if !options[:with_deleted]
81
+ with_deleted_scope { return call_original_find.call }
82
+ end
83
+
84
+ call_original_find.call
85
+ end
79
86
 
80
- def with_scope(method_scoping = {}, is_new_scope = true)
81
- # Dup first and second level of hash (method and params).
82
- method_scoping = method_scoping.inject({}) do |hash, (method, params)|
83
- hash[method] = params.dup
84
- hash
87
+ def find_with_deleted(*args)
88
+ original_find(*(args << extract_options_from_args!(args).merge(:with_deleted => true)))
85
89
  end
86
90
 
87
- method_scoping.assert_valid_keys [:find, :create]
88
- if f = method_scoping[:find]
89
- f.assert_valid_keys [:conditions, :joins, :offset, :limit, :readonly]
90
- f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
91
+ def count(conditions = nil, joins = nil)
92
+ with_deleted_scope { count_with_deleted(conditions, joins) }
91
93
  end
92
94
 
93
- raise ArgumentError, "Nested scopes are not yet supported: #{scoped_methods.inspect}" unless scoped_methods.nil?
95
+ def with_scope(method_scoping = {}, is_new_scope = true)
96
+ # Dup first and second level of hash (method and params).
97
+ method_scoping = method_scoping.inject({}) do |hash, (method, params)|
98
+ hash[method] = params.dup
99
+ hash
100
+ end
94
101
 
95
- self.scoped_methods = method_scoping
96
- yield
97
- ensure
98
- self.scoped_methods = nil if is_new_scope
99
- end
102
+ method_scoping.assert_valid_keys [:find, :create]
103
+ if f = method_scoping[:find]
104
+ f.assert_valid_keys [:conditions, :joins, :offset, :limit, :readonly]
105
+ f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
106
+ end
100
107
 
101
- protected
102
- def with_deleted_scope(&block)
103
- deleted_cond = "#{table_name}.deleted_at IS NULL"
104
- if scoped_methods.nil?
105
- is_new_scope = true
106
- current_scope = {}
107
- else
108
- is_new_scope = false
109
- current_scope = scoped_methods.clone
110
- self.scoped_methods = nil
108
+ raise ArgumentError, "Nested scopes are not yet supported: #{scoped_methods.inspect}" unless scoped_methods.nil?
109
+
110
+ self.scoped_methods = method_scoping
111
+ yield
112
+ ensure
113
+ self.scoped_methods = nil if is_new_scope
111
114
  end
115
+
116
+ protected
117
+ def with_deleted_scope(&block)
118
+ deleted_cond = "#{table_name}.deleted_at IS NULL"
119
+ if scoped_methods.nil?
120
+ is_new_scope = true
121
+ current_scope = {}
122
+ else
123
+ is_new_scope = false
124
+ current_scope = scoped_methods.clone
125
+ self.scoped_methods = nil
126
+ end
112
127
 
113
- current_scope ||= {}
114
- current_scope[:find] ||= {}
115
- if not current_scope[:find][:conditions] =~ /#{deleted_cond}/
116
- current_scope[:find][:conditions] = current_scope[:find][:conditions].nil? ?
117
- deleted_cond :
118
- "(#{current_scope[:find][:conditions]}) AND #{deleted_cond}"
119
- end
128
+ current_scope ||= {}
129
+ current_scope[:find] ||= {}
130
+ if not current_scope[:find][:conditions] =~ /#{deleted_cond}/
131
+ current_scope[:find][:conditions] = current_scope[:find][:conditions].nil? ?
132
+ deleted_cond :
133
+ "(#{current_scope[:find][:conditions]}) AND #{deleted_cond}"
134
+ end
120
135
 
121
- with_scope(current_scope, is_new_scope, &block)
136
+ with_scope(current_scope, is_new_scope, &block)
137
+ end
122
138
  end
123
139
 
124
- def validate_find_options(options)
125
- options.assert_valid_keys [:conditions, :include, :joins, :limit, :offset, :order, :select, :readonly, :with_deleted]
126
- end
127
- end
128
-
129
- def destroy_without_callbacks
130
- unless new_record?
131
- sql = self.class.send(:sanitize_sql,
132
- ["UPDATE #{self.class.table_name} SET deleted_at = ? WHERE id = ?",
133
- self.class.default_timezone == :utc ? Time.now.utc : Time.now, id])
134
- self.connection.update(sql)
140
+ def destroy_without_callbacks
141
+ unless new_record?
142
+ sql = self.class.send(:sanitize_sql,
143
+ ["UPDATE #{self.class.table_name} SET deleted_at = ? WHERE id = ?",
144
+ self.class.default_timezone == :utc ? Time.now.utc : Time.now, id])
145
+ self.connection.update(sql)
146
+ end
147
+ freeze
135
148
  end
136
- freeze
137
- end
138
149
 
139
- def destroy_with_callbacks!
140
- return false if callback(:before_destroy) == false
141
- result = destroy_without_callbacks!
142
- callback(:after_destroy)
143
- result
144
- end
150
+ def destroy_with_callbacks!
151
+ return false if callback(:before_destroy) == false
152
+ result = destroy_without_callbacks!
153
+ callback(:after_destroy)
154
+ result
155
+ end
145
156
 
146
- def destroy!
147
- transaction { destroy_with_callbacks! }
157
+ def destroy!
158
+ transaction { destroy_with_callbacks! }
159
+ end
148
160
  end
149
161
  end
150
162
  end
151
163
  end
152
164
  end
153
165
 
154
- ActiveRecord::Base.class_eval do
155
- include ActiveRecord::Acts::Paranoid
156
- end
166
+ ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord
data/test/debug.log ADDED
@@ -0,0 +1,704 @@
1
+ # Logfile created on Tue Dec 20 21:35:51 CST 2005 by logger.rb/1.5.2.4
2
+ SQL (0.000000) SQLite::Exceptions::SQLException: no such table: widgets: DROP TABLE widgets
3
+ SQL (0.005210) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
4
+ SQL (0.000000) SQLite::Exceptions::SQLException: no such table: categories: DROP TABLE categories
5
+ SQL (0.003470) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
6
+ SQL (0.000000) SQLite::Exceptions::SQLException: no such table: categories_widgets: DROP TABLE categories_widgets
7
+ SQL (0.003810) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
8
+ SQL (0.004224) CREATE TABLE schema_info (version integer)
9
+ SQL (0.003689) INSERT INTO schema_info (version) VALUES(0)
10
+ SQL (0.000762) PRAGMA table_info(schema_info)
11
+ SQL (0.006911) UPDATE schema_info SET version = 1
12
+ Widget Count (0.001137) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
13
+ Widget Count (0.000691) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
14
+ Widget Count (0.000747) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
15
+ Widget Count (0.001069) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
16
+ Widget Load (0.000991) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
17
+ SQL (0.001241) PRAGMA table_info(widgets)
18
+ Widget Load (0.002992) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
19
+ Widget Load (0.000566) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
20
+ Widget Load (0.000454) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
21
+ Widget Count (0.000885) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
22
+ Category Count (0.000795) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
23
+ Widget Load (0.001047) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
24
+ Category Load (0.000848) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
25
+ SQL (0.001224) PRAGMA table_info(categories)
26
+ SQL (0.002276) UPDATE categories SET deleted_at = '2005-12-20 21:35:52' WHERE id = 1
27
+ Widget Destroy (0.000530)  DELETE FROM widgets
28
+ WHERE id = 1
29
+ 
30
+ Widget Count (0.000737) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
31
+ Category Count (0.000655) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
32
+ Widget Count (0.000947) SELECT COUNT(*) FROM widgets 
33
+ Category Count (0.049925) SELECT COUNT(*) FROM categories 
34
+ Category Load (0.001103) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
35
+ Widget Load (0.000896) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
36
+ Category Load (0.000811) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
37
+ Widget Load (0.000940) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
38
+ Category Load (0.001320) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
39
+ Category Load (0.001176) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
40
+ Widget Load (0.000982) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
41
+ Category Load (0.001036) SELECT * FROM categories WHERE (categories.widget_id = 2) 
42
+ Category Load (0.001090) SELECT * FROM categories WHERE (categories.widget_id = 2) 
43
+ Category Load (0.001249) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
44
+ Widget Load (0.000866) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
45
+ Category Load (0.000818) SELECT * FROM categories WHERE (categories.widget_id = 2) LIMIT 1
46
+ Widget Load (0.001490) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
47
+ Widget Load (0.000824) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
48
+ Widget Load (0.000733) SELECT * FROM widgets ORDER BY id desc LIMIT 1
49
+ Widget Load (0.001154) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
50
+ Widget Load (0.001164) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
51
+ Widget Load (0.001027) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
52
+ Widget Load (0.001023) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
53
+ Widget Load (0.002383) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
54
+ Widget Load (0.000754) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
55
+ Widget Load (0.000994) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
56
+ Widget Count (0.000828) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
57
+ Widget Count (0.000769) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
58
+ Widget Count (0.000724) SELECT COUNT(*) FROM widgets 
59
+ Widget Load (0.000982) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
60
+ Widget Load (0.000785) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
61
+ Widget Load (0.000864) SELECT * FROM widgets ORDER BY id 
62
+ Category Count (0.001361) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
63
+ Widget Load (0.004062) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
64
+ Category Count (0.000851) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
65
+ Category Load (0.001045) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
66
+ Category Load (0.001186) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
67
+ Category Load (0.001159) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
68
+ Widget Count (0.000898) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
69
+ Widget Count (0.000786) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
70
+ Widget Count (0.000701) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
71
+ Widget Load (0.000924) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
72
+ Widget Load (0.000575) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
73
+ Widget Load (0.007056) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
74
+ Widget Count (0.000909) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
75
+ Category Count (0.001101) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
76
+ Widget Load (0.001064) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
77
+ Category Load (0.003699) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
78
+ SQL (0.003892) UPDATE categories SET deleted_at = '2005-12-20 21:35:52' WHERE id = 1
79
+ Category Load (0.000728) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
80
+ SQL (0.001064) UPDATE widgets SET deleted_at = '2005-12-20 21:35:52' WHERE id = 1
81
+ Widget Count (0.000702) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
82
+ Category Count (0.000696) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
83
+ Widget Count (0.000931) SELECT COUNT(*) FROM widgets 
84
+ Category Count (0.000972) SELECT COUNT(*) FROM categories 
85
+ SQL (0.005387) DROP TABLE widgets
86
+ SQL (0.003986) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
87
+ SQL (0.003770) DROP TABLE categories
88
+ SQL (0.003536) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
89
+ SQL (0.004193) DROP TABLE categories_widgets
90
+ SQL (0.005201) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
91
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
92
+ SQL (0.000746) PRAGMA table_info(schema_info)
93
+ SQL (0.003631) UPDATE schema_info SET version = 1
94
+ Widget Count (0.000991) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
95
+ Widget Count (0.000696) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
96
+ Widget Count (0.000806) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
97
+ Widget Count (0.000663) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
98
+ Widget Load (0.000851) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
99
+ SQL (0.001322) PRAGMA table_info(widgets)
100
+ Widget Load (0.000791) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
101
+ Widget Load (0.000534) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
102
+ Widget Load (0.000488) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
103
+ Widget Count (0.000835) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
104
+ Category Count (0.000793) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
105
+ Widget Load (0.001138) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
106
+ Category Load (0.000991) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
107
+ SQL (0.001347) PRAGMA table_info(categories)
108
+ SQL (0.003938) UPDATE categories SET deleted_at = '2005-12-20 21:39:32' WHERE id = 1
109
+ Widget Destroy (0.000512)  DELETE FROM widgets
110
+ WHERE id = 1
111
+ 
112
+ Widget Count (0.000793) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
113
+ Category Count (0.000712) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
114
+ Widget Count (0.001093) SELECT COUNT(*) FROM widgets 
115
+ Category Count (0.000672) SELECT COUNT(*) FROM categories 
116
+ Category Load (0.001395) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
117
+ Widget Load (0.000911) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
118
+ Category Load (0.000971) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
119
+ Widget Load (0.000873) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
120
+ Category Load (0.001397) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
121
+ Category Load (0.001278) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
122
+ Widget Load (0.001013) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
123
+ Category Load (0.001344) SELECT * FROM categories WHERE (categories.widget_id = 2) 
124
+ Category Load (0.001142) SELECT * FROM categories WHERE (categories.widget_id = 2) 
125
+ Category Load (0.005247) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
126
+ Widget Load (0.000912) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
127
+ Category Load (0.001265) SELECT * FROM categories WHERE (categories.widget_id = 2) LIMIT 1
128
+ Widget Load (0.006354) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
129
+ Widget Load (0.000864) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
130
+ Widget Load (0.000813) SELECT * FROM widgets ORDER BY id desc LIMIT 1
131
+ Widget Load (0.001148) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
132
+ Widget Load (0.001077) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
133
+ Widget Load (0.001226) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
134
+ Widget Load (0.001044) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
135
+ Widget Load (0.000847) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
136
+ Widget Load (0.000621) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
137
+ Widget Load (0.005349) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
138
+ Widget Count (0.000844) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
139
+ Widget Count (0.001020) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
140
+ Widget Count (0.001099) SELECT COUNT(*) FROM widgets 
141
+ Widget Load (0.024509) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
142
+ Widget Load (0.001008) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
143
+ Widget Load (0.001410) SELECT * FROM widgets ORDER BY id 
144
+ Category Count (0.000886) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
145
+ Widget Load (0.001461) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
146
+ Category Count (0.001001) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
147
+ Category Load (0.003967) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
148
+ Category Load (0.000966) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
149
+ Category Load (0.001201) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
150
+ Widget Count (0.000843) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
151
+ Widget Count (0.000765) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
152
+ Widget Count (0.000702) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
153
+ Widget Load (0.000971) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
154
+ Widget Load (0.000633) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
155
+ Widget Load (0.000958) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
156
+ Widget Count (0.000819) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
157
+ Category Count (0.001071) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
158
+ Widget Load (0.000910) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
159
+ Category Load (0.000873) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
160
+ SQL (0.002291) UPDATE categories SET deleted_at = '2005-12-20 21:39:32' WHERE id = 1
161
+ Category Load (0.000758) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
162
+ SQL (0.001042) UPDATE widgets SET deleted_at = '2005-12-20 21:39:32' WHERE id = 1
163
+ Widget Count (0.000735) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
164
+ Category Count (0.000806) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
165
+ Widget Count (0.000619) SELECT COUNT(*) FROM widgets 
166
+ Category Count (0.000691) SELECT COUNT(*) FROM categories 
167
+ SQL (0.210229) DROP TABLE widgets
168
+ SQL (0.003330) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
169
+ SQL (0.003780) DROP TABLE categories
170
+ SQL (0.003642) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
171
+ SQL (0.003950) DROP TABLE categories_widgets
172
+ SQL (0.004232) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
173
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
174
+ SQL (0.000678) PRAGMA table_info(schema_info)
175
+ SQL (0.004167) UPDATE schema_info SET version = 1
176
+ Widget Count (0.000944) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
177
+ Widget Count (0.000789) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
178
+ Widget Count (0.000864) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
179
+ Widget Count (0.000726) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
180
+ Widget Load (0.000868) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
181
+ SQL (0.001171) PRAGMA table_info(widgets)
182
+ Widget Load (0.000806) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
183
+ Widget Load (0.000548) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
184
+ Widget Load (0.000438) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
185
+ Widget Count (0.000815) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
186
+ Category Count (0.001105) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
187
+ Widget Load (0.001050) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
188
+ Category Load (0.002607) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
189
+ SQL (0.001249) PRAGMA table_info(categories)
190
+ SQL (0.002234) UPDATE categories SET deleted_at = '2005-12-20 21:44:30' WHERE id = 1
191
+ Widget Destroy (0.000580)  DELETE FROM widgets
192
+ WHERE id = 1
193
+ 
194
+ Widget Count (0.001249) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
195
+ Category Count (0.000738) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
196
+ Widget Count (0.000588) SELECT COUNT(*) FROM widgets 
197
+ Category Count (0.000554) SELECT COUNT(*) FROM categories 
198
+ Category Load (0.000903) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
199
+ Widget Load (0.000909) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
200
+ Category Load (0.000853) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
201
+ Widget Load (0.000915) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
202
+ Category Load (0.001532) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
203
+ Category Load (0.001280) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
204
+ Widget Load (0.001231) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
205
+ Category Load (0.001058) SELECT * FROM categories WHERE (categories.widget_id = 2) 
206
+ Category Load (0.000900) SELECT * FROM categories WHERE (categories.widget_id = 2) 
207
+ Category Load (0.000961) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
208
+ Widget Load (0.000964) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
209
+ Category Load (0.000868) SELECT * FROM categories WHERE (categories.widget_id = 2) LIMIT 1
210
+ Widget Load (0.001039) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
211
+ Widget Load (0.000991) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
212
+ Widget Load (0.000991) SELECT * FROM widgets ORDER BY id desc LIMIT 1
213
+ Widget Load (0.005053) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
214
+ Widget Load (0.001121) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
215
+ Widget Load (0.000906) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
216
+ Widget Load (0.001375) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
217
+ Widget Load (0.000816) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
218
+ Widget Load (0.000636) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
219
+ Widget Load (0.001007) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
220
+ Widget Count (0.000856) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
221
+ Widget Count (0.000713) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
222
+ Widget Count (0.000706) SELECT COUNT(*) FROM widgets 
223
+ Widget Load (0.002784) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
224
+ Widget Load (0.000833) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
225
+ Widget Load (0.000929) SELECT * FROM widgets ORDER BY id 
226
+ Category Count (0.000941) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
227
+ Widget Load (0.001205) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
228
+ Category Count (0.000903) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
229
+ Category Load (0.000927) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
230
+ Category Load (0.001126) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
231
+ Category Load (0.001142) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
232
+ Widget Count (0.000861) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
233
+ Widget Count (0.001137) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
234
+ Widget Count (0.000751) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
235
+ Widget Load (0.001057) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
236
+ Widget Load (0.000863) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
237
+ Widget Load (0.000766) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
238
+ Widget Count (0.001070) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
239
+ Category Count (0.000778) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
240
+ Widget Load (0.001988) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
241
+ Category Load (0.001206) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
242
+ SQL (0.002590) UPDATE categories SET deleted_at = '2005-12-20 21:44:31' WHERE id = 1
243
+ Category Load (0.000771) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
244
+ SQL (0.001006) UPDATE widgets SET deleted_at = '2005-12-20 21:44:31' WHERE id = 1
245
+ Widget Count (0.000783) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
246
+ Category Count (0.000767) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
247
+ Widget Count (0.001006) SELECT COUNT(*) FROM widgets 
248
+ Category Count (0.000614) SELECT COUNT(*) FROM categories 
249
+ SQL (0.000000) Mysql::Error: #42S02Unknown table 'widgets': DROP TABLE widgets
250
+ SQL (0.108845) CREATE TABLE widgets (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `title` varchar(50), `category_id` int(11), `deleted_at` datetime) ENGINE=InnoDB
251
+ SQL (0.000000) Mysql::Error: #42S02Unknown table 'categories': DROP TABLE categories
252
+ SQL (0.303185) CREATE TABLE categories (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `widget_id` int(11), `title` varchar(50), `deleted_at` datetime) ENGINE=InnoDB
253
+ SQL (0.000000) Mysql::Error: #42S02Unknown table 'categories_widgets': DROP TABLE categories_widgets
254
+ SQL (0.172973) CREATE TABLE categories_widgets (`category_id` int(11), `widget_id` int(11)) ENGINE=InnoDB
255
+ SQL (0.006421) CREATE TABLE schema_info (version int(11))
256
+ SQL (0.004668) INSERT INTO schema_info (version) VALUES(0)
257
+ SQL (0.001682) SHOW FIELDS FROM schema_info
258
+ SQL (0.001595) UPDATE schema_info SET version = 1
259
+ SQL (0.000589) BEGIN
260
+ Widget Count (0.013224) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
261
+ Widget Count (0.001192) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
262
+ Widget Count (0.001308) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
263
+ Widget Count (0.001093) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
264
+ SQL (0.000604) ROLLBACK
265
+ SQL (0.000334) BEGIN
266
+ Widget Load (0.001973) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
267
+ Widget Columns (0.002095) SHOW FIELDS FROM widgets
268
+ Widget Load (0.001684) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
269
+ Widget Load (0.001665) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
270
+ Widget Load (0.001676) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
271
+ SQL (0.000559) ROLLBACK
272
+ SQL (0.000336) BEGIN
273
+ Widget Count (0.001010) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
274
+ Category Count (0.002666) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
275
+ Widget Load (0.001892) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
276
+ Category Load (0.002059) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
277
+ Category Columns (0.002128) SHOW FIELDS FROM categories
278
+ SQL (0.000912) UPDATE categories SET deleted_at = '2005-12-20 21:45:30' WHERE id = 1
279
+ Widget Destroy (0.000891)  DELETE FROM widgets
280
+ WHERE id = 1
281
+ 
282
+ Widget Count (0.001090) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
283
+ Category Count (0.001992) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
284
+ Widget Count (0.001052) SELECT COUNT(*) FROM widgets 
285
+ Category Count (0.001006) SELECT COUNT(*) FROM categories 
286
+ SQL (0.143604) ROLLBACK
287
+ SQL (0.000351) BEGIN
288
+ Category Load (0.009769) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
289
+ Widget Load (0.001594) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
290
+ Category Load (0.002851) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
291
+ SQL (0.000602) ROLLBACK
292
+ SQL (0.000329) BEGIN
293
+ Widget Load (0.005816) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
294
+ Category Load (0.002254) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
295
+ Category Load (0.005368) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories_widgets.widget_id = 2 ) 
296
+ SQL (0.000594) ROLLBACK
297
+ SQL (0.000376) BEGIN
298
+ Widget Load (0.001559) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
299
+ Category Load (0.001999) SELECT * FROM categories WHERE (categories.widget_id = 2) 
300
+ Category Load (0.003359) SELECT * FROM categories WHERE (categories.widget_id = 2) 
301
+ SQL (0.000586) ROLLBACK
302
+ SQL (0.000329) BEGIN
303
+ Category Load (0.001557) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
304
+ Widget Load (0.001641) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
305
+ Category Load (0.001709) SELECT * FROM categories WHERE (categories.widget_id = 2) LIMIT 1
306
+ SQL (0.000808) ROLLBACK
307
+ SQL (0.000404) BEGIN
308
+ Widget Load (0.001848) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
309
+ Widget Load (0.004493) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
310
+ Widget Load (0.016891) SELECT * FROM widgets ORDER BY id desc LIMIT 1
311
+ SQL (0.000806) ROLLBACK
312
+ SQL (0.000326) BEGIN
313
+ Widget Load (0.008019) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
314
+ Widget Load (0.003361) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
315
+ Widget Load (0.001786) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
316
+ SQL (0.000747) ROLLBACK
317
+ SQL (0.000361) BEGIN
318
+ Widget Load (0.005606) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
319
+ Widget Load (0.001651) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
320
+ Widget Load (0.001789) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
321
+ SQL (0.000559) ROLLBACK
322
+ SQL (0.000339) BEGIN
323
+ SQL (0.000379) ROLLBACK
324
+ SQL (0.008059) BEGIN
325
+ Widget Load (0.001700) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
326
+ SQL (0.000574) ROLLBACK
327
+ SQL (0.000359) BEGIN
328
+ Widget Count (0.001354) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
329
+ Widget Count (0.001362) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
330
+ Widget Count (0.000998) SELECT COUNT(*) FROM widgets 
331
+ SQL (0.000501) ROLLBACK
332
+ SQL (0.000337) BEGIN
333
+ Widget Load (0.005722) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
334
+ Widget Load (0.002523) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
335
+ Widget Load (0.001704) SELECT * FROM widgets ORDER BY id 
336
+ SQL (0.000594) ROLLBACK
337
+ SQL (0.000368) BEGIN
338
+ Category Count (0.001128) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
339
+ Widget Load (0.098541) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
340
+ Category Count (0.001304) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
341
+ Category Load (0.001751) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
342
+ Category Load (0.001690) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
343
+ Category Load (0.003320) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
344
+ SQL (0.000581) ROLLBACK
345
+ SQL (0.000318) BEGIN
346
+ Widget Count (0.001108) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
347
+ Widget Count (0.006215) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
348
+ Widget Count (0.001340) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
349
+ SQL (0.000529) ROLLBACK
350
+ SQL (0.000323) BEGIN
351
+ Widget Load (0.004626) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
352
+ Widget Load (0.001954) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
353
+ Widget Load (0.001696) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
354
+ SQL (0.000560) ROLLBACK
355
+ SQL (0.000325) BEGIN
356
+ Widget Count (0.001016) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
357
+ Category Count (0.000923) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
358
+ Widget Load (0.005375) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
359
+ Category Load (0.002086) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
360
+ SQL (0.003609) UPDATE categories SET deleted_at = '2005-12-20 21:45:31' WHERE id = 1
361
+ Category Load (0.002191) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
362
+ SQL (0.000967) UPDATE widgets SET deleted_at = '2005-12-20 21:45:31' WHERE id = 1
363
+ Widget Count (0.001056) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
364
+ Category Count (0.001107) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
365
+ Widget Count (0.001105) SELECT COUNT(*) FROM widgets 
366
+ Category Count (0.000939) SELECT COUNT(*) FROM categories 
367
+ SQL (0.049515) ROLLBACK
368
+ SQL (0.005008) DROP TABLE widgets
369
+ SQL (0.003520) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
370
+ SQL (0.003360) DROP TABLE categories
371
+ SQL (0.003970) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
372
+ SQL (0.005072) DROP TABLE categories_widgets
373
+ SQL (0.004037) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
374
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
375
+ SQL (0.000672) PRAGMA table_info(schema_info)
376
+ SQL (0.004726) UPDATE schema_info SET version = 1
377
+ Widget Count (0.000908) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
378
+ Widget Count (0.000817) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
379
+ Widget Count (0.000806) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
380
+ Widget Count (0.000705) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
381
+ Widget Load (0.000838) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
382
+ SQL (0.001213) PRAGMA table_info(widgets)
383
+ Widget Load (0.000967) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
384
+ Widget Load (0.000550) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
385
+ Widget Load (0.000454) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
386
+ Widget Count (0.000929) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
387
+ Category Count (0.000765) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
388
+ Widget Load (0.001055) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
389
+ Category Load (0.000881) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
390
+ SQL (0.001236) PRAGMA table_info(categories)
391
+ SQL (0.052966) UPDATE categories SET deleted_at = '2005-12-20 21:53:01' WHERE id = 1
392
+ Widget Destroy (0.000508)  DELETE FROM widgets
393
+ WHERE id = 1
394
+ 
395
+ Widget Count (0.000708) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
396
+ Category Count (0.000690) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
397
+ Widget Count (0.000748) SELECT COUNT(*) FROM widgets 
398
+ Category Count (0.000607) SELECT COUNT(*) FROM categories 
399
+ Category Load (0.000998) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
400
+ Widget Load (0.000833) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
401
+ Category Load (0.000631) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 3) LIMIT 1
402
+ Widget Load (0.000882) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
403
+ Category Load (0.000839) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 2 ) 
404
+ Widget Load (0.000935) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
405
+ Category Load (0.000707) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 2) 
406
+ Category Load (0.001094) SELECT * FROM categories WHERE (categories.id = 3) LIMIT 1
407
+ Widget Load (0.000917) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
408
+ Category Load (0.000583) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 2) LIMIT 1
409
+ Widget Load (0.000998) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
410
+ Widget Load (0.000775) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
411
+ Widget Load (0.000859) SELECT * FROM widgets ORDER BY id desc LIMIT 1
412
+ Widget Load (0.001161) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
413
+ Widget Load (0.001224) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
414
+ Widget Load (0.001236) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
415
+ Widget Load (0.001001) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
416
+ Widget Load (0.000897) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
417
+ Widget Load (0.000630) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
418
+ Widget Load (0.000938) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
419
+ Widget Count (0.001208) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
420
+ Widget Count (0.000845) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
421
+ Widget Count (0.000822) SELECT COUNT(*) FROM widgets 
422
+ Widget Load (0.003749) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
423
+ Widget Load (0.000808) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
424
+ Widget Load (0.000984) SELECT * FROM widgets ORDER BY id 
425
+ Category Count (0.000926) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
426
+ Widget Load (0.001002) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
427
+ Category Count (0.000819) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
428
+ Category Load (0.003591) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
429
+ Category Load (0.000804) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
430
+ Category Load (0.001173) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
431
+ Widget Count (0.000857) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
432
+ Widget Count (0.000850) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
433
+ Widget Count (0.000645) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
434
+ Widget Load (0.004564) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
435
+ Widget Load (0.000641) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
436
+ Widget Load (0.000724) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
437
+ Widget Count (0.000880) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
438
+ Category Count (0.000750) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
439
+ Widget Load (0.000922) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
440
+ Category Load (0.000921) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
441
+ SQL (0.002290) UPDATE categories SET deleted_at = '2005-12-20 21:53:02' WHERE id = 1
442
+ Category Load (0.000761) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
443
+ SQL (0.001884) UPDATE widgets SET deleted_at = '2005-12-20 21:53:02' WHERE id = 1
444
+ Widget Count (0.000825) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
445
+ Category Count (0.000664) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
446
+ Widget Count (0.000579) SELECT COUNT(*) FROM widgets 
447
+ Category Count (0.000657) SELECT COUNT(*) FROM categories 
448
+ SQL (0.275146) DROP TABLE widgets
449
+ SQL (0.003831) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
450
+ SQL (0.003815) DROP TABLE categories
451
+ SQL (0.003818) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
452
+ SQL (0.004017) DROP TABLE categories_widgets
453
+ SQL (0.004034) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
454
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
455
+ SQL (0.000688) PRAGMA table_info(schema_info)
456
+ SQL (0.003865) UPDATE schema_info SET version = 1
457
+ Widget Count (0.000927) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
458
+ Widget Count (0.000671) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
459
+ Widget Count (0.001255) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
460
+ Widget Count (0.001000) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
461
+ Widget Load (0.001039) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
462
+ SQL (0.001233) PRAGMA table_info(widgets)
463
+ Widget Load (0.000788) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
464
+ Widget Load (0.000535) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
465
+ Widget Load (0.000451) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
466
+ Widget Count (0.000852) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
467
+ Category Count (0.000791) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
468
+ Widget Load (0.049942) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
469
+ Category Load (0.000908) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
470
+ SQL (0.001520) PRAGMA table_info(categories)
471
+ SQL (0.002254) UPDATE categories SET deleted_at = '2005-12-20 21:53:30' WHERE id = 1
472
+ Widget Destroy (0.000502)  DELETE FROM widgets
473
+ WHERE id = 1
474
+ 
475
+ Widget Count (0.000735) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
476
+ Category Count (0.000702) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
477
+ Widget Count (0.000669) SELECT COUNT(*) FROM widgets 
478
+ Category Count (0.000686) SELECT COUNT(*) FROM categories 
479
+ Widget Load (0.001010) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
480
+ Widget Load (0.000838) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
481
+ Widget Load (0.000860) SELECT * FROM widgets ORDER BY id desc LIMIT 1
482
+ Widget Load (0.001065) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
483
+ Widget Load (0.000944) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
484
+ Widget Load (0.000920) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
485
+ Widget Load (0.001846) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
486
+ Widget Load (0.001001) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
487
+ Widget Load (0.000623) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
488
+ Widget Load (0.001035) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
489
+ Widget Count (0.000861) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
490
+ Widget Count (0.000790) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
491
+ Widget Count (0.000603) SELECT COUNT(*) FROM widgets 
492
+ Widget Load (0.001003) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
493
+ Widget Load (0.000786) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
494
+ Widget Load (0.000986) SELECT * FROM widgets ORDER BY id 
495
+ Category Count (0.000866) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
496
+ Widget Load (0.001120) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
497
+ Category Count (0.000917) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
498
+ Category Load (0.000906) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
499
+ Category Load (0.000817) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
500
+ Category Load (0.001348) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
501
+ Widget Count (0.000875) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
502
+ Widget Count (0.000882) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
503
+ Widget Count (0.000702) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
504
+ Widget Load (0.001072) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
505
+ Widget Load (0.000611) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
506
+ Widget Load (0.000761) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
507
+ Widget Count (0.000847) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
508
+ Category Count (0.000773) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
509
+ Widget Load (0.001318) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
510
+ Category Load (0.001015) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
511
+ SQL (0.002528) UPDATE categories SET deleted_at = '2005-12-20 21:53:30' WHERE id = 1
512
+ Category Load (0.000723) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
513
+ SQL (0.000982) UPDATE widgets SET deleted_at = '2005-12-20 21:53:30' WHERE id = 1
514
+ Widget Count (0.000834) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
515
+ Category Count (0.000978) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
516
+ Widget Count (0.000710) SELECT COUNT(*) FROM widgets 
517
+ Category Count (0.000644) SELECT COUNT(*) FROM categories 
518
+ SQL (0.005208) DROP TABLE widgets
519
+ SQL (0.003828) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
520
+ SQL (0.003297) DROP TABLE categories
521
+ SQL (0.003368) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
522
+ SQL (0.003747) DROP TABLE categories_widgets
523
+ SQL (0.003895) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
524
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
525
+ SQL (0.000675) PRAGMA table_info(schema_info)
526
+ SQL (0.003291) UPDATE schema_info SET version = 1
527
+ Widget Count (0.000976) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
528
+ Widget Count (0.000680) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
529
+ Widget Count (0.000883) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
530
+ Widget Count (0.000953) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
531
+ Widget Count (0.000849) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
532
+ Category Count (0.000776) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
533
+ Widget Count (0.003856) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
534
+ Widget Count (0.000854) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
535
+ Widget Count (0.000641) SELECT COUNT(*) FROM widgets 
536
+ Category Count (0.000847) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
537
+ Widget Count (0.000877) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
538
+ Widget Count (0.000818) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
539
+ Widget Count (0.000743) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
540
+ Widget Load (0.001319) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
541
+ SQL (0.001092) PRAGMA table_info(widgets)
542
+ Widget Load (0.000548) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
543
+ Widget Count (0.000849) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
544
+ Category Count (0.000847) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
545
+ SQL (0.285232) DROP TABLE widgets
546
+ SQL (0.003755) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
547
+ SQL (0.003270) DROP TABLE categories
548
+ SQL (0.003342) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
549
+ SQL (0.004357) DROP TABLE categories_widgets
550
+ SQL (0.004184) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
551
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
552
+ SQL (0.001098) PRAGMA table_info(schema_info)
553
+ SQL (0.003748) UPDATE schema_info SET version = 1
554
+ Widget Count (0.000990) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
555
+ Widget Count (0.000697) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
556
+ Widget Count (0.000817) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
557
+ Widget Count (0.000672) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
558
+ Widget Load (0.000876) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
559
+ SQL (0.001173) PRAGMA table_info(widgets)
560
+ Widget Load (0.000767) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
561
+ Widget Load (0.000542) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
562
+ Widget Load (0.000464) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
563
+ Widget Count (0.000993) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
564
+ Category Count (0.000826) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
565
+ Widget Count (0.000824) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
566
+ Widget Count (0.000774) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
567
+ Widget Count (0.000638) SELECT COUNT(*) FROM widgets 
568
+ Category Count (0.000878) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
569
+ Widget Count (0.000871) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
570
+ Widget Count (0.000917) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
571
+ Widget Count (0.000687) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
572
+ Widget Load (0.004625) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
573
+ Widget Load (0.000575) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
574
+ Widget Load (0.000745) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
575
+ Widget Count (0.001877) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
576
+ Category Count (0.003986) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
577
+ SQL (0.192103) DROP TABLE widgets
578
+ SQL (0.003459) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
579
+ SQL (0.003610) DROP TABLE categories
580
+ SQL (0.003132) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
581
+ SQL (0.003668) DROP TABLE categories_widgets
582
+ SQL (0.003981) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
583
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
584
+ SQL (0.000732) PRAGMA table_info(schema_info)
585
+ SQL (0.003191) UPDATE schema_info SET version = 1
586
+ Widget Count (0.000929) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
587
+ Widget Count (0.000971) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
588
+ Widget Count (0.000835) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
589
+ Widget Count (0.000742) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
590
+ Widget Count (0.000913) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
591
+ Category Count (0.000815) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
592
+ Widget Load (0.001300) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
593
+ SQL (0.001211) PRAGMA table_info(widgets)
594
+ Category Load (0.000798) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
595
+ SQL (0.027503) PRAGMA table_info(categories)
596
+ SQL (0.002336) UPDATE categories SET deleted_at = '2005-12-20 21:59:05' WHERE id = 1
597
+ Widget Destroy (0.000524)  DELETE FROM widgets
598
+ WHERE id = 1
599
+ 
600
+ Widget Count (0.000768) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
601
+ Category Count (0.000708) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
602
+ Widget Count (0.000608) SELECT COUNT(*) FROM widgets 
603
+ Category Count (0.000571) SELECT COUNT(*) FROM categories 
604
+ Widget Load (0.000939) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
605
+ Widget Load (0.001447) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
606
+ Widget Load (0.001009) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
607
+ Widget Load (0.001211) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
608
+ Widget Count (0.000828) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
609
+ Widget Count (0.000784) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
610
+ Widget Count (0.000628) SELECT COUNT(*) FROM widgets 
611
+ Widget Load (0.001164) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
612
+ Widget Load (0.001077) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
613
+ Category Count (0.000877) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
614
+ Widget Load (0.001007) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
615
+ Category Count (0.000860) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
616
+ Category Load (0.000984) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
617
+ Category Load (0.000810) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
618
+ Category Load (0.001614) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
619
+ Widget Count (0.003604) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
620
+ Widget Count (0.000748) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
621
+ Widget Count (0.000712) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
622
+ Widget Load (0.001096) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
623
+ Widget Load (0.000776) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
624
+ Widget Count (0.000891) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
625
+ Category Count (0.001265) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
626
+ Widget Load (0.000931) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
627
+ Category Load (0.000931) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
628
+ SQL (0.002404) UPDATE categories SET deleted_at = '2005-12-20 21:59:05' WHERE id = 1
629
+ Category Load (0.000735) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
630
+ SQL (0.003828) UPDATE widgets SET deleted_at = '2005-12-20 21:59:05' WHERE id = 1
631
+ Widget Count (0.000815) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
632
+ Category Count (0.000774) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
633
+ Widget Count (0.000625) SELECT COUNT(*) FROM widgets 
634
+ Category Count (0.000596) SELECT COUNT(*) FROM categories 
635
+ SQL (0.208987) DROP TABLE widgets
636
+ SQL (0.003366) CREATE TABLE widgets ("id" INTEGER PRIMARY KEY NOT NULL, "title" varchar(50), "category_id" integer, "deleted_at" datetime) 
637
+ SQL (0.003342) DROP TABLE categories
638
+ SQL (0.002896) CREATE TABLE categories ("id" INTEGER PRIMARY KEY NOT NULL, "widget_id" integer, "title" varchar(50), "deleted_at" datetime) 
639
+ SQL (0.003803) DROP TABLE categories_widgets
640
+ SQL (0.003867) CREATE TABLE categories_widgets ("category_id" integer, "widget_id" integer) 
641
+ SQL (0.000000) SQLite::Exceptions::SQLException: table schema_info already exists: CREATE TABLE schema_info (version integer)
642
+ SQL (0.000749) PRAGMA table_info(schema_info)
643
+ SQL (0.003083) UPDATE schema_info SET version = 1
644
+ Widget Count (0.001203) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
645
+ Widget Count (0.000701) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
646
+ Widget Count (0.000808) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
647
+ Widget Count (0.000694) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
648
+ Widget Load (0.000856) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
649
+ SQL (0.001643) PRAGMA table_info(widgets)
650
+ Widget Load (0.000794) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
651
+ Widget Load (0.000539) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
652
+ Widget Load (0.000528) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
653
+ Widget Count (0.000829) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
654
+ Category Count (0.000774) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
655
+ Widget Load (0.002044) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
656
+ Category Load (0.000957) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
657
+ SQL (0.001257) PRAGMA table_info(categories)
658
+ SQL (0.027504) UPDATE categories SET deleted_at = '2005-12-20 21:59:39' WHERE id = 1
659
+ Widget Destroy (0.000603)  DELETE FROM widgets
660
+ WHERE id = 1
661
+ 
662
+ Widget Count (0.000709) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
663
+ Category Count (0.000667) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
664
+ Widget Count (0.000581) SELECT COUNT(*) FROM widgets 
665
+ Category Count (0.000569) SELECT COUNT(*) FROM categories 
666
+ Widget Load (0.000928) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
667
+ Widget Load (0.000907) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) LIMIT 1
668
+ Widget Load (0.000843) SELECT * FROM widgets ORDER BY id desc LIMIT 1
669
+ Widget Load (0.001219) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
670
+ Widget Load (0.000960) SELECT * FROM widgets WHERE (widgets.id IN (1,2)) 
671
+ Widget Load (0.000922) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id IN (1,2)) 
672
+ Widget Load (0.000924) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
673
+ Widget Load (0.000801) SELECT * FROM widgets WHERE (widgets.id = 2) LIMIT 1
674
+ Widget Load (0.000611) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 2) LIMIT 1
675
+ Widget Load (0.000908) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
676
+ Widget Count (0.000846) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
677
+ Widget Count (0.000786) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) AND (title='widget 1') 
678
+ Widget Count (0.000577) SELECT COUNT(*) FROM widgets 
679
+ Widget Load (0.001090) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
680
+ Widget Load (0.000938) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) 
681
+ Widget Load (0.000992) SELECT * FROM widgets ORDER BY id 
682
+ Category Count (0.000861) SELECT COUNT(*) FROM categories WHERE (widget_id=1) 
683
+ Widget Load (0.001027) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
684
+ Category Count (0.000913) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
685
+ Category Load (0.001381) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.id = 1) LIMIT 1
686
+ Category Load (0.000828) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
687
+ Category Load (0.001073) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
688
+ Widget Count (0.000870) SELECT COUNT(*) FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
689
+ Widget Count (0.000970) SELECT COUNT(*) FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
690
+ Widget Count (0.000825) SELECT COUNT(*) FROM widgets WHERE (title = 'deleted widget 2') 
691
+ Widget Load (0.004679) SELECT * FROM widgets WHERE ((title = 'widget 1') AND widgets.deleted_at IS NULL) 
692
+ Widget Load (0.000610) SELECT * FROM widgets WHERE ((title = 'deleted widget 2') AND widgets.deleted_at IS NULL) 
693
+ Widget Load (0.001106) SELECT * FROM widgets WHERE (title = 'deleted widget 2') 
694
+ Widget Count (0.000820) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
695
+ Category Count (0.000916) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
696
+ Widget Load (0.000966) SELECT * FROM widgets WHERE (widgets.deleted_at IS NULL) AND (widgets.id = 1) LIMIT 1
697
+ Category Load (0.001041) SELECT * FROM categories WHERE (categories.deleted_at IS NULL) AND (categories.widget_id = 1) 
698
+ SQL (0.002575) UPDATE categories SET deleted_at = '2005-12-20 21:59:40' WHERE id = 1
699
+ Category Load (0.000747) SELECT * FROM categories LEFT JOIN categories_widgets ON categories.id = categories_widgets.category_id WHERE (categories.deleted_at IS NULL) AND (categories_widgets.widget_id = 1 ) 
700
+ SQL (0.000986) UPDATE widgets SET deleted_at = '2005-12-20 21:59:40' WHERE id = 1
701
+ Widget Count (0.000696) SELECT COUNT(*) FROM widgets WHERE (widgets.deleted_at IS NULL) 
702
+ Category Count (0.000686) SELECT COUNT(*) FROM categories WHERE (categories.deleted_at IS NULL) 
703
+ Widget Count (0.001363) SELECT COUNT(*) FROM widgets 
704
+ Category Count (0.000664) SELECT COUNT(*) FROM categories 
@@ -6,4 +6,14 @@ category_2:
6
6
  id: 2
7
7
  widget_id: 1
8
8
  title: 'category 2'
9
+ deleted_at: '2005-01-01 00:00:00'
10
+ category_3:
11
+ id: 3
12
+ widget_id: 2
13
+ title: 'category 3'
14
+ deleted_at: '2005-01-01 00:00:00'
15
+ category_4:
16
+ id: 4
17
+ widget_id: 2
18
+ title: 'category 4'
9
19
  deleted_at: '2005-01-01 00:00:00'
@@ -3,4 +3,10 @@ cw_1:
3
3
  widget_id: 1
4
4
  cw_2:
5
5
  category_id: 2
6
- widget_id: 1
6
+ widget_id: 1
7
+ cw_3:
8
+ category_id: 3
9
+ widget_id: 2
10
+ cw_4:
11
+ category_id: 4
12
+ widget_id: 2
@@ -4,4 +4,5 @@ widget_1:
4
4
  widget_2:
5
5
  id: 2
6
6
  title: 'deleted widget 2'
7
- deleted_at: '2005-01-01 00:00:00'
7
+ deleted_at: '2005-01-01 00:00:00'
8
+ category_id: 3
@@ -4,6 +4,8 @@ class Widget < ActiveRecord::Base
4
4
  acts_as_paranoid
5
5
  has_many :categories, :dependent => true
6
6
  has_and_belongs_to_many :habtm_categories, :class_name => 'Category'
7
+ has_one :category
8
+ belongs_to :parent_category, :class_name => 'Category'
7
9
  end
8
10
 
9
11
  class Category < ActiveRecord::Base
@@ -11,6 +13,9 @@ class Category < ActiveRecord::Base
11
13
  acts_as_paranoid
12
14
  end
13
15
 
16
+ class NonParanoidAndroid < ActiveRecord::Base
17
+ end
18
+
14
19
  class ParanoidTest < Test::Unit::TestCase
15
20
  fixtures :widgets, :categories, :categories_widgets
16
21
 
@@ -21,7 +26,7 @@ class ParanoidTest < Test::Unit::TestCase
21
26
  assert_equal 0, Widget.count
22
27
  assert_equal 0, Category.count
23
28
  assert_equal 2, Widget.count_with_deleted
24
- assert_equal 2, Category.count_with_deleted
29
+ assert_equal 4, Category.count_with_deleted
25
30
  end
26
31
 
27
32
  def test_should_destroy
@@ -32,7 +37,7 @@ class ParanoidTest < Test::Unit::TestCase
32
37
  assert_equal 0, Category.count
33
38
  assert_equal 1, Widget.count_with_deleted
34
39
  # Category doesn't get destroyed because the dependent before_destroy callback uses #destroy
35
- assert_equal 2, Category.count_with_deleted
40
+ assert_equal 4, Category.count_with_deleted
36
41
  end
37
42
 
38
43
  def test_should_not_count_deleted
@@ -107,6 +112,36 @@ class ParanoidTest < Test::Unit::TestCase
107
112
  assert_equal 0, Widget.count, 'clobbers the constrain on a paranoid find'
108
113
  end
109
114
  end
115
+
116
+ def test_should_give_paranoid_status
117
+ assert Widget.paranoid?
118
+ assert !NonParanoidAndroid.paranoid?
119
+ end
120
+
121
+ # sorry charlie, these are out!
122
+ #def test_should_find_deleted_has_many_assocations_on_deleted_records_by_default
123
+ # w = Widget.find_with_deleted 2
124
+ # assert_equal 2, w.categories.length
125
+ # assert_equal 2, w.categories(true).size
126
+ #end
127
+ #
128
+ #def test_should_find_deleted_habtm_assocations_on_deleted_records_by_default
129
+ # w = Widget.find_with_deleted 2
130
+ # assert_equal 2, w.habtm_categories.length
131
+ # assert_equal 2, w.habtm_categories(true).size
132
+ #end
133
+ #
134
+ #def test_should_find_deleted_has_one_associations_on_deleted_records_by_default
135
+ # c = Category.find_with_deleted 3
136
+ # w = Widget.find_with_deleted 2
137
+ # assert_equal c, w.category
138
+ #end
139
+ #
140
+ #def test_should_find_deleted_belongs_to_associations_on_deleted_records_by_default
141
+ # c = Category.find_with_deleted 3
142
+ # w = Widget.find_with_deleted 2
143
+ # assert_equal c, w.parent_category
144
+ #end
110
145
  end
111
146
 
112
147
  class Array
data/test/schema.rb CHANGED
@@ -2,6 +2,7 @@ ActiveRecord::Schema.define(:version => 1) do
2
2
 
3
3
  create_table :widgets, :force => true do |t|
4
4
  t.column :title, :string, :limit => 50
5
+ t.column :category_id, :integer
5
6
  t.column :deleted_at, :timestamp
6
7
  end
7
8
 
data/test/test_helper.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
2
 
3
3
  require 'test/unit'
4
- #require 'active_record'
5
- #require 'active_support/binding_of_caller'
6
- #require 'active_support/breakpoint'
7
- require "#{File.dirname(__FILE__)}/../../../../config/environment"
4
+ require 'rubygems'
5
+ require 'active_record'
8
6
  require 'active_record/fixtures'
7
+ require 'active_support/binding_of_caller'
8
+ require 'active_support/breakpoint'
9
9
  require "#{File.dirname(__FILE__)}/../init"
10
10
 
11
11
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: acts_as_paranoid
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.2"
7
- date: 2005-11-15
6
+ version: 0.3.1
7
+ date: 2005-12-20
8
8
  summary: acts_as_paranoid keeps models from actually being deleted by setting a deleted_at field.
9
9
  require_paths:
10
10
  - lib
@@ -29,6 +29,7 @@ authors:
29
29
  files:
30
30
  - lib/acts_as_paranoid.rb
31
31
  - test/database.yml
32
+ - test/debug.log
32
33
  - test/fixtures
33
34
  - test/paranoid_test.rb
34
35
  - test/schema.rb