track_changes 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 0
4
+ :patch: 1
5
5
  :build:
@@ -30,7 +30,10 @@ module TrackChanges
30
30
  def before(controller)
31
31
  self.models.each do |model|
32
32
  instance_variable_symbol = "@#{model}".to_sym
33
- self.cached_models[instance_variable_symbol] = controller.instance_variable_get(instance_variable_symbol).clone
33
+ instance = controller.instance_variable_get(instance_variable_symbol)
34
+ next if instance.nil?
35
+
36
+ self.cached_models[instance_variable_symbol] = instance.clone
34
37
  end
35
38
  end
36
39
 
@@ -115,3 +115,354 @@ updated_at:
115
115
  Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
116
116
  Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
117
117
  SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
118
+ SQL (0.2ms)  SELECT name
119
+ FROM sqlite_master
120
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
121
+ 
122
+ SQL (0.1ms) select sqlite_version(*)
123
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
124
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
125
+ SQL (0.1ms)  SELECT name
126
+ FROM sqlite_master
127
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
128
+ 
129
+ SQL (0.0ms) SELECT version FROM schema_migrations
130
+ Migrating to CreateAudits (20100115021125)
131
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
132
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
133
+ Migrating to CreatePosts (20100115021151)
134
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
135
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
136
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:19:01', '2010-01-15 05:19:01')
137
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
138
+
139
+
140
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:19:02) [PUT]
141
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
142
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
143
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:19:02' WHERE "id" = 1
144
+ Redirected to http://test.host/posts/1
145
+ WARNING: Can't mass-assign these protected attributes: id
146
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
147
+ title:
148
+ - Hello, World
149
+ - First post!
150
+ updated_at:
151
+ - 2010-01-15 05:19:01 Z
152
+ - 2010-01-15 05:19:02.030127 Z
153
+ ', '2010-01-15 05:19:02', '2010-01-15 05:19:02')
154
+ Completed in 46ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
155
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
156
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
157
+ SQL (0.2ms)  SELECT name
158
+ FROM sqlite_master
159
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
160
+ 
161
+ SQL (0.1ms) select sqlite_version(*)
162
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
163
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
164
+ SQL (0.1ms)  SELECT name
165
+ FROM sqlite_master
166
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
167
+ 
168
+ SQL (0.1ms) SELECT version FROM schema_migrations
169
+ Migrating to CreateAudits (20100115021125)
170
+ SQL (0.2ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
171
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
172
+ Migrating to CreatePosts (20100115021151)
173
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
174
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
175
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:21:15', '2010-01-15 05:21:15')
176
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
177
+
178
+
179
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:21:15) [PUT]
180
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
181
+ Post Load (0.2ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
182
+ Post Update (0.1ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:21:15' WHERE "id" = 1
183
+ Redirected to http://test.host/posts/1
184
+ WARNING: Can't mass-assign these protected attributes: id
185
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
186
+ title:
187
+ - Hello, World
188
+ - First post!
189
+ updated_at:
190
+ - 2010-01-15 05:21:15 Z
191
+ - 2010-01-15 05:21:15.424603 Z
192
+ ', '2010-01-15 05:21:15', '2010-01-15 05:21:15')
193
+ Completed in 76ms (DB: 2) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
194
+ Audit Load (0.2ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
195
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
196
+ SQL (0.2ms)  SELECT name
197
+ FROM sqlite_master
198
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
199
+ 
200
+ SQL (0.1ms) select sqlite_version(*)
201
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
202
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
203
+ SQL (0.1ms)  SELECT name
204
+ FROM sqlite_master
205
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
206
+ 
207
+ SQL (0.0ms) SELECT version FROM schema_migrations
208
+ Migrating to CreateAudits (20100115021125)
209
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
210
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
211
+ Migrating to CreatePosts (20100115021151)
212
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
213
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
214
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:21:23', '2010-01-15 05:21:23')
215
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
216
+
217
+
218
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:21:23) [PUT]
219
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
220
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
221
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:21:23' WHERE "id" = 1
222
+ Redirected to http://test.host/posts/1
223
+ WARNING: Can't mass-assign these protected attributes: id
224
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
225
+ title:
226
+ - Hello, World
227
+ - First post!
228
+ updated_at:
229
+ - 2010-01-15 05:21:23 Z
230
+ - 2010-01-15 05:21:23.881869 Z
231
+ ', '2010-01-15 05:21:23', '2010-01-15 05:21:23')
232
+ Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
233
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
234
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
235
+ SQL (0.2ms)  SELECT name
236
+ FROM sqlite_master
237
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
238
+ 
239
+ SQL (0.1ms) select sqlite_version(*)
240
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
241
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
242
+ SQL (0.1ms)  SELECT name
243
+ FROM sqlite_master
244
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
245
+ 
246
+ SQL (0.0ms) SELECT version FROM schema_migrations
247
+ Migrating to CreateAudits (20100115021125)
248
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
249
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
250
+ Migrating to CreatePosts (20100115021151)
251
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
252
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
253
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:22:27', '2010-01-15 05:22:27')
254
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
255
+
256
+
257
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:22:27) [PUT]
258
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
259
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
260
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:22:27' WHERE "id" = 1
261
+ Redirected to http://test.host/posts/1
262
+ WARNING: Can't mass-assign these protected attributes: id
263
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
264
+ title:
265
+ - Hello, World
266
+ - First post!
267
+ updated_at:
268
+ - 2010-01-15 05:22:27 Z
269
+ - 2010-01-15 05:22:27.549001 Z
270
+ ', '2010-01-15 05:22:27', '2010-01-15 05:22:27')
271
+ Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
272
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
273
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
274
+ SQL (0.2ms)  SELECT name
275
+ FROM sqlite_master
276
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
277
+ 
278
+ SQL (0.1ms) select sqlite_version(*)
279
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
280
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
281
+ SQL (0.1ms)  SELECT name
282
+ FROM sqlite_master
283
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
284
+ 
285
+ SQL (0.0ms) SELECT version FROM schema_migrations
286
+ Migrating to CreateAudits (20100115021125)
287
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
288
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
289
+ Migrating to CreatePosts (20100115021151)
290
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
291
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
292
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:22:49', '2010-01-15 05:22:49')
293
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
294
+
295
+
296
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:22:49) [PUT]
297
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
298
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
299
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:22:49' WHERE "id" = 1
300
+ Redirected to http://test.host/posts/1
301
+ WARNING: Can't mass-assign these protected attributes: id
302
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
303
+ title:
304
+ - Hello, World
305
+ - First post!
306
+ updated_at:
307
+ - 2010-01-15 05:22:49 Z
308
+ - 2010-01-15 05:22:49.384072 Z
309
+ ', '2010-01-15 05:22:49', '2010-01-15 05:22:49')
310
+ Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
311
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
312
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
313
+ SQL (0.2ms)  SELECT name
314
+ FROM sqlite_master
315
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
316
+ 
317
+ SQL (0.1ms) select sqlite_version(*)
318
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
319
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
320
+ SQL (0.1ms)  SELECT name
321
+ FROM sqlite_master
322
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
323
+ 
324
+ SQL (0.0ms) SELECT version FROM schema_migrations
325
+ Migrating to CreateAudits (20100115021125)
326
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
327
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
328
+ Migrating to CreatePosts (20100115021151)
329
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
330
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
331
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:23:18', '2010-01-15 05:23:18')
332
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
333
+
334
+
335
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:23:18) [PUT]
336
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
337
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
338
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:23:18' WHERE "id" = 1
339
+ Redirected to http://test.host/posts/1
340
+ WARNING: Can't mass-assign these protected attributes: id
341
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
342
+ title:
343
+ - Hello, World
344
+ - First post!
345
+ updated_at:
346
+ - 2010-01-15 05:23:18 Z
347
+ - 2010-01-15 05:23:18.400459 Z
348
+ ', '2010-01-15 05:23:18', '2010-01-15 05:23:18')
349
+ Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
350
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
351
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
352
+ SQL (0.2ms)  SELECT name
353
+ FROM sqlite_master
354
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
355
+ 
356
+ SQL (0.1ms) select sqlite_version(*)
357
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
358
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
359
+ SQL (0.1ms)  SELECT name
360
+ FROM sqlite_master
361
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
362
+ 
363
+ SQL (0.0ms) SELECT version FROM schema_migrations
364
+ Migrating to CreateAudits (20100115021125)
365
+ SQL (0.1ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
366
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
367
+ Migrating to CreatePosts (20100115021151)
368
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
369
+ SQL (0.0ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
370
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:23:29', '2010-01-15 05:23:29')
371
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
372
+
373
+
374
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:23:29) [PUT]
375
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
376
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
377
+ Post Update (0.0ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:23:29' WHERE "id" = 1
378
+ Redirected to http://test.host/posts/1
379
+ WARNING: Can't mass-assign these protected attributes: id
380
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
381
+ title:
382
+ - Hello, World
383
+ - First post!
384
+ updated_at:
385
+ - 2010-01-15 05:23:29 Z
386
+ - 2010-01-15 05:23:29.951713 Z
387
+ ', '2010-01-15 05:23:29', '2010-01-15 05:23:29')
388
+ Completed in 47ms (DB: 1) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
389
+ Audit Load (0.1ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
390
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
391
+ SQL (0.2ms)  SELECT name
392
+ FROM sqlite_master
393
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
394
+ 
395
+ SQL (0.1ms) select sqlite_version(*)
396
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
397
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
398
+ SQL (0.1ms)  SELECT name
399
+ FROM sqlite_master
400
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
401
+ 
402
+ SQL (0.1ms) SELECT version FROM schema_migrations
403
+ Migrating to CreateAudits (20100115021125)
404
+ SQL (0.2ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
405
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
406
+ Migrating to CreatePosts (20100115021151)
407
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
408
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
409
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:23:45', '2010-01-15 05:23:45')
410
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
411
+
412
+
413
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:23:45) [PUT]
414
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
415
+ Post Load (0.2ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
416
+ Post Update (0.1ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:23:45' WHERE "id" = 1
417
+ Redirected to http://test.host/posts/1
418
+ WARNING: Can't mass-assign these protected attributes: id
419
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
420
+ title:
421
+ - Hello, World
422
+ - First post!
423
+ updated_at:
424
+ - 2010-01-15 05:23:45 Z
425
+ - 2010-01-15 05:23:45.209463 Z
426
+ ', '2010-01-15 05:23:45', '2010-01-15 05:23:45')
427
+ Completed in 80ms (DB: 2) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
428
+ Audit Load (0.2ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
429
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
430
+ SQL (0.2ms)  SELECT name
431
+ FROM sqlite_master
432
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
433
+ 
434
+ SQL (0.1ms) select sqlite_version(*)
435
+ SQL (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
436
+ SQL (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
437
+ SQL (0.1ms)  SELECT name
438
+ FROM sqlite_master
439
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
440
+ 
441
+ SQL (0.1ms) SELECT version FROM schema_migrations
442
+ Migrating to CreateAudits (20100115021125)
443
+ SQL (0.2ms) CREATE TABLE "audits" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "audited_type" varchar(255), "audited_id" integer, "user" varchar(255), "change_set" text, "created_at" datetime, "updated_at" datetime) 
444
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021125')
445
+ Migrating to CreatePosts (20100115021151)
446
+ SQL (0.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "author" varchar(255), "created_at" datetime, "updated_at" datetime) 
447
+ SQL (0.1ms) INSERT INTO schema_migrations (version) VALUES ('20100115021151')
448
+ Post Create (0.1ms) INSERT INTO "posts" ("title", "body", "author", "created_at", "updated_at") VALUES('Hello, World', 'This is a test.', 'Matt Haley', '2010-01-15 05:26:53', '2010-01-15 05:26:53')
449
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
450
+
451
+
452
+ Processing PostsController#update (for 0.0.0.0 at 2010-01-14 22:26:53) [PUT]
453
+ Parameters: {"post"=>{"title"=>"First post!"}, "id"=>"1"}
454
+ Post Load (0.2ms) SELECT * FROM "posts" WHERE ("posts"."id" = 1) 
455
+ Post Update (0.1ms) UPDATE "posts" SET "title" = 'First post!', "updated_at" = '2010-01-15 05:26:53' WHERE "id" = 1
456
+ Redirected to http://test.host/posts/1
457
+ WARNING: Can't mass-assign these protected attributes: id
458
+ Audit Create (0.1ms) INSERT INTO "audits" ("audited_type", "audited_id", "user", "change_set", "created_at", "updated_at") VALUES('Post', 1, 'John Smith', '---
459
+ title:
460
+ - Hello, World
461
+ - First post!
462
+ updated_at:
463
+ - 2010-01-15 05:26:53 Z
464
+ - 2010-01-15 05:26:53.660386 Z
465
+ ', '2010-01-15 05:26:53', '2010-01-15 05:26:53')
466
+ Completed in 76ms (DB: 2) | 302 Found [http://test.host/posts/1?post%5Btitle%5D=First+post%21]
467
+ Audit Load (0.2ms) SELECT * FROM "audits" WHERE ("audits".audited_id = 1 AND "audits".audited_type = 'Post') LIMIT 1
468
+ SQL (0.1ms) SELECT count(*) AS count_all FROM "audits" 
@@ -43,5 +43,16 @@ module TrackChanges
43
43
  audit.expects(:create!).with(has_entries(:user => expected_user, :change_set => expected_change_set)).returns(true)
44
44
  audit_filter.after(controller)
45
45
  end
46
+
47
+ should "ignore nil models" do
48
+ controller = mock('controller')
49
+ controller.expects(:instance_variable_get).returns(nil)
50
+
51
+ audit_filter = AuditFilter.new(:model)
52
+ assert_nothing_raised do
53
+ audit_filter.before(controller)
54
+ audit_filter.after(controller)
55
+ end
56
+ end
46
57
  end
47
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: track_changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Haley