news_feed 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module NewsFeed
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
Binary file
@@ -111,3 +111,35 @@ Migrating to InsertNewsFeedEvents (20120807021300)
111
111
   (0.0ms) PRAGMA index_list("news_feed")
112
112
   (0.1ms) PRAGMA index_list("news_feed_events")
113
113
   (0.0ms) PRAGMA index_list("users")
114
+ Connecting to database specified by database.yml
115
+ Connecting to database specified by database.yml
116
+ Connecting to database specified by database.yml
117
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
118
+  (0.4ms) select sqlite_version(*)
119
+  (3.3ms) CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
120
+  (1.4ms) CREATE TABLE "news_feed" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "object_id" integer, "object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "timestamp" datetime)
121
+  (2.3ms) CREATE TABLE "news_feed_events" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "event_object_id" integer, "event_object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "sender_type" integer, "recipient_id" integer, "recipient_type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
122
+  (1.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
123
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
124
+  (0.0ms) PRAGMA index_list("schema_migrations")
125
+  (3.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
126
+  (0.1ms) SELECT version FROM "schema_migrations"
127
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20120807021300')
128
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806220426')
129
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806195421')
130
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806213224')
131
+ Connecting to database specified by database.yml
132
+  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
133
+  (0.3ms) select sqlite_version(*)
134
+  (2.9ms) CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
135
+  (1.3ms) CREATE TABLE "news_feed" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "object_id" integer, "object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "timestamp" datetime)
136
+  (1.6ms) CREATE TABLE "news_feed_events" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "event_object_id" integer, "event_object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "sender_type" integer, "recipient_id" integer, "recipient_type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
137
+  (1.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
138
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
139
+  (0.0ms) PRAGMA index_list("schema_migrations")
140
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
141
+  (0.1ms) SELECT version FROM "schema_migrations"
142
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20120807021300')
143
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806220426')
144
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806195421')
145
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120806213224')
@@ -1338,3 +1338,177 @@ Connecting to database specified by database.yml
1338
1338
  SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:06:07 UTC +00:00], ["event_object_id", 10], ["event_object_type", "User"], ["event_type", :Update], ["recipient_id", 10], ["recipient_type", "User"], ["sender_id", 10], ["sender_type", 0], ["text", "You have updated a User: Bob Smith"], ["updated_at", Thu, 09 Aug 2012 04:06:07 UTC +00:00]]
1339
1339
   (0.0ms) commit transaction
1340
1340
  NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 10 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1341
+ Connecting to database specified by database.yml
1342
+  (1.4ms) select sqlite_version(*)
1343
+  (0.4ms) CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1344
+  (0.2ms) CREATE TABLE "news_feed" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "object_id" integer, "object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "timestamp" datetime) 
1345
+  (0.2ms) CREATE TABLE "news_feed_events" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "event_object_id" integer, "event_object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "sender_type" integer, "recipient_id" integer, "recipient_type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1346
+  (0.2ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
1347
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1348
+  (0.0ms) PRAGMA index_list("schema_migrations")
1349
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1350
+  (0.1ms) SELECT version FROM "schema_migrations"
1351
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
1352
+  (0.1ms) begin transaction
1353
+  (0.0ms) rollback transaction
1354
+  (0.1ms) begin transaction
1355
+ SQL (5.6ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1356
+  (0.1ms) commit transaction
1357
+  (0.1ms) begin transaction
1358
+ SQL (0.3ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1359
+  (0.1ms) commit transaction
1360
+  (0.1ms) begin transaction
1361
+ SQL (0.3ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1362
+  (0.1ms) commit transaction
1363
+  (0.1ms) begin transaction
1364
+ SQL (0.4ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 1], ["event_object_type", "Message"], ["event_type", :Create], ["recipient_id", 1], ["recipient_type", "User"], ["sender_id", 2], ["sender_type", 0], ["text", "Bob Smith has created a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1365
+  (0.1ms) commit transaction
1366
+ NewsFeedEvent Load (0.2ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 1 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1367
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" ORDER BY "news_feed_events"."id" DESC LIMIT 1
1368
+  (0.0ms) begin transaction
1369
+ SQL (0.2ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1370
+  (0.0ms) commit transaction
1371
+  (0.0ms) begin transaction
1372
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1373
+  (0.0ms) commit transaction
1374
+  (0.0ms) begin transaction
1375
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1376
+  (0.0ms) commit transaction
1377
+  (0.0ms) begin transaction
1378
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 2], ["event_object_type", "Message"], ["event_type", :Delete], ["recipient_id", 3], ["recipient_type", "User"], ["sender_id", 4], ["sender_type", 0], ["text", "Bob Smith has deleted a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1379
+  (0.0ms) commit transaction
1380
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 3 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1381
+  (0.0ms) begin transaction
1382
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1383
+  (0.0ms) commit transaction
1384
+  (0.0ms) begin transaction
1385
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1386
+  (0.0ms) commit transaction
1387
+  (0.0ms) begin transaction
1388
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1389
+  (0.0ms) commit transaction
1390
+  (0.0ms) begin transaction
1391
+ SQL (0.1ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 3], ["event_object_type", "Message"], ["event_type", :Delete], ["recipient_id", 5], ["recipient_type", "User"], ["sender_id", 6], ["sender_type", 0], ["text", "Bob Smith has deleted a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1392
+  (0.0ms) commit transaction
1393
+  (0.0ms) begin transaction
1394
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 3], ["event_object_type", "Message"], ["event_type", :Create], ["recipient_id", 5], ["recipient_type", "User"], ["sender_id", 6], ["sender_type", 0], ["text", "Bob Smith has created a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1395
+  (0.0ms) commit transaction
1396
+  (0.1ms) SELECT COUNT(*) FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 5
1397
+  (0.0ms) begin transaction
1398
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1399
+  (0.0ms) commit transaction
1400
+  (0.0ms) begin transaction
1401
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1402
+  (0.0ms) commit transaction
1403
+  (0.0ms) begin transaction
1404
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1405
+  (0.0ms) commit transaction
1406
+  (0.0ms) begin transaction
1407
+ SQL (0.1ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 4], ["event_object_type", "Message"], ["event_type", :Send], ["recipient_id", 7], ["recipient_type", "User"], ["sender_id", 8], ["sender_type", 0], ["text", "Bob Smith has sent you a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1408
+  (0.0ms) commit transaction
1409
+  (0.0ms) begin transaction
1410
+ SQL (0.1ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 4], ["event_object_type", "Message"], ["event_type", :Send], ["recipient_id", 8], ["recipient_type", "User"], ["sender_id", 8], ["sender_type", 0], ["text", "You have sent Bob Smith a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1411
+  (0.0ms) commit transaction
1412
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 7 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1413
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 8 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1414
+  (0.0ms) begin transaction
1415
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1416
+  (0.0ms) commit transaction
1417
+  (0.0ms) begin transaction
1418
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1419
+  (0.0ms) commit transaction
1420
+  (0.0ms) begin transaction
1421
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1422
+  (0.0ms) commit transaction
1423
+  (0.0ms) begin transaction
1424
+ SQL (0.1ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00], ["event_object_id", 10], ["event_object_type", "User"], ["event_type", :Update], ["recipient_id", 10], ["recipient_type", "User"], ["sender_id", 10], ["sender_type", 0], ["text", "You have updated a User: Bob Smith"], ["updated_at", Thu, 09 Aug 2012 04:20:38 UTC +00:00]]
1425
+  (0.1ms) commit transaction
1426
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 10 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1427
+ Connecting to database specified by database.yml
1428
+ Connecting to database specified by database.yml
1429
+ Connecting to database specified by database.yml
1430
+  (1.6ms) select sqlite_version(*)
1431
+  (0.5ms) CREATE TABLE "messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1432
+  (0.2ms) CREATE TABLE "news_feed" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "object_id" integer, "object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "timestamp" datetime) 
1433
+  (0.2ms) CREATE TABLE "news_feed_events" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text, "event_object_id" integer, "event_object_type" varchar(255), "event_type" varchar(255), "sender_id" integer, "sender_type" integer, "recipient_id" integer, "recipient_type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1434
+  (0.2ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
1435
+  (0.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1436
+  (0.0ms) PRAGMA index_list("schema_migrations")
1437
+  (0.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1438
+  (0.1ms) SELECT version FROM "schema_migrations"
1439
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
1440
+  (0.1ms) begin transaction
1441
+  (0.0ms) rollback transaction
1442
+  (0.1ms) begin transaction
1443
+ SQL (6.4ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1444
+  (0.1ms) commit transaction
1445
+  (0.1ms) begin transaction
1446
+ SQL (0.3ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1447
+  (0.0ms) commit transaction
1448
+  (0.1ms) begin transaction
1449
+ SQL (0.4ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1450
+  (0.1ms) commit transaction
1451
+  (0.1ms) begin transaction
1452
+ SQL (0.3ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 1], ["event_object_type", "Message"], ["event_type", :Create], ["recipient_id", 1], ["recipient_type", "User"], ["sender_id", 2], ["sender_type", 0], ["text", "Bob Smith has created a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1453
+  (0.0ms) commit transaction
1454
+ NewsFeedEvent Load (0.2ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 1 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1455
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" ORDER BY "news_feed_events"."id" DESC LIMIT 1
1456
+  (0.1ms) begin transaction
1457
+ SQL (0.2ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1458
+  (0.0ms) commit transaction
1459
+  (0.0ms) begin transaction
1460
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1461
+  (0.0ms) commit transaction
1462
+  (0.0ms) begin transaction
1463
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1464
+  (0.0ms) commit transaction
1465
+  (0.0ms) begin transaction
1466
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 2], ["event_object_type", "Message"], ["event_type", :Delete], ["recipient_id", 3], ["recipient_type", "User"], ["sender_id", 4], ["sender_type", 0], ["text", "Bob Smith has deleted a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1467
+  (0.0ms) commit transaction
1468
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 3 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1469
+  (0.0ms) begin transaction
1470
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1471
+  (0.0ms) commit transaction
1472
+  (0.0ms) begin transaction
1473
+ SQL (0.2ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1474
+  (0.0ms) commit transaction
1475
+  (0.0ms) begin transaction
1476
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1477
+  (0.0ms) commit transaction
1478
+  (0.0ms) begin transaction
1479
+ SQL (0.1ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 3], ["event_object_type", "Message"], ["event_type", :Delete], ["recipient_id", 5], ["recipient_type", "User"], ["sender_id", 6], ["sender_type", 0], ["text", "Bob Smith has deleted a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1480
+  (0.0ms) commit transaction
1481
+  (0.0ms) begin transaction
1482
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 3], ["event_object_type", "Message"], ["event_type", :Create], ["recipient_id", 5], ["recipient_type", "User"], ["sender_id", 6], ["sender_type", 0], ["text", "Bob Smith has created a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1483
+  (0.0ms) commit transaction
1484
+  (0.1ms) SELECT COUNT(*) FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 5
1485
+  (0.0ms) begin transaction
1486
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1487
+  (0.1ms) commit transaction
1488
+  (0.0ms) begin transaction
1489
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1490
+  (0.0ms) commit transaction
1491
+  (0.0ms) begin transaction
1492
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1493
+  (0.0ms) commit transaction
1494
+  (0.0ms) begin transaction
1495
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 4], ["event_object_type", "Message"], ["event_type", :Send], ["recipient_id", 7], ["recipient_type", "User"], ["sender_id", 8], ["sender_type", 0], ["text", "Bob Smith has sent you a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1496
+  (0.0ms) commit transaction
1497
+  (0.0ms) begin transaction
1498
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 4], ["event_object_type", "Message"], ["event_type", :Send], ["recipient_id", 8], ["recipient_type", "User"], ["sender_id", 8], ["sender_type", 0], ["text", "You have sent Bob Smith a Message: Message Title"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1499
+  (0.0ms) commit transaction
1500
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 7 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1501
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 8 ORDER BY "news_feed_events"."id" DESC LIMIT 1
1502
+  (0.0ms) begin transaction
1503
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1504
+  (0.0ms) commit transaction
1505
+  (0.0ms) begin transaction
1506
+ SQL (0.1ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1507
+  (0.0ms) commit transaction
1508
+  (0.0ms) begin transaction
1509
+ SQL (0.1ms) INSERT INTO "messages" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1510
+  (0.0ms) commit transaction
1511
+  (0.0ms) begin transaction
1512
+ SQL (0.2ms) INSERT INTO "news_feed_events" ("created_at", "event_object_id", "event_object_type", "event_type", "recipient_id", "recipient_type", "sender_id", "sender_type", "text", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00], ["event_object_id", 10], ["event_object_type", "User"], ["event_type", :Update], ["recipient_id", 10], ["recipient_type", "User"], ["sender_id", 10], ["sender_type", 0], ["text", "You have updated a User: Bob Smith"], ["updated_at", Thu, 09 Aug 2012 04:22:52 UTC +00:00]]
1513
+  (0.0ms) commit transaction
1514
+ NewsFeedEvent Load (0.1ms) SELECT "news_feed_events".* FROM "news_feed_events" WHERE "news_feed_events"."recipient_id" = 10 ORDER BY "news_feed_events"."id" DESC LIMIT 1
@@ -0,0 +1,7 @@
1
+ en:
2
+ news_feeds:
3
+ create_object: "%{actor} created a %{object_class}: %{object_name}"
4
+ update_object: "%{actor} updated a %{object_class}: %{object_name}"
5
+ delete_object: "%{actor} deleted a %{object_class}: %{object_name}"
6
+ send_object: "%{actor} sent %{recipient_name} a %{object_class}: %{object_name}"
7
+
@@ -0,0 +1,30 @@
1
+ module NewsFeed
2
+ module NewsFeedEvents
3
+ def generate_text(event_name, actor_name, object_class, object_title, recipient_name = nil)
4
+ # event_name is what the cases will check for
5
+ # actor_name is the user object that performs the action
6
+ # object_class is the class of the object of interest
7
+ # recipient_name can include the recipient name
8
+
9
+ case event_name
10
+ when :Create
11
+ I18n.t('news_feeds.create_object', actor: actor_name.to_s, object_class: object_class,
12
+ object_name: object_title)
13
+ when :Update
14
+ I18n.t('news_feeds.update_object', actor: actor_name.to_s, object_class: object_class,
15
+ object_name: object_title)
16
+ when :Delete
17
+ I18n.t('news_feeds.delete_object', actor: actor_name.to_s, object_class: object_class,
18
+ object_name: object_title)
19
+ when :Send
20
+ I18n.t('news_feeds.send_object', actor: actor_name.to_s, object_class: object_class,
21
+ object_name: object_title, recipient_name: recipient_name)
22
+ else
23
+ raise "event_name is undefined"
24
+ end
25
+
26
+
27
+ end
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: news_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -92,6 +92,8 @@ files:
92
92
  - test/dummy/config/locales/en_news_feed.yml
93
93
  - test/news_feed_test.rb
94
94
  - test/test_helper.rb
95
+ - test/tmp/lib/news_feed/news_feed_events.rb
96
+ - test/tmp/config/locales/en_news_feed.yml
95
97
  - test/generators/install_generator_test.rb
96
98
  homepage: ''
97
99
  licenses: []
@@ -165,4 +167,6 @@ test_files:
165
167
  - test/dummy/config/locales/en_news_feed.yml
166
168
  - test/news_feed_test.rb
167
169
  - test/test_helper.rb
170
+ - test/tmp/lib/news_feed/news_feed_events.rb
171
+ - test/tmp/config/locales/en_news_feed.yml
168
172
  - test/generators/install_generator_test.rb