marks 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 Masahiro Ihara
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -22,6 +22,12 @@ module Marks
22
22
  raise ArgumentError unless types.map { |t| t.to_s.classify }.include?(classified_mark)
23
23
  outgoing_marks.where(mark_type: classified_mark, markable_type: markable.class.table_name.classify, markable_id: markable).any?
24
24
  end
25
+
26
+ define_method :'unmarks' do |markable, mark|
27
+ classified_mark = mark.to_s.classify
28
+ raise ArgumentError unless types.map { |t| t.to_s.classify }.include?(classified_mark)
29
+ outgoing_marks.where(mark_type: classified_mark, markable_type: markable.class.table_name.classify, markable_id: markable).delete_all
30
+ end
25
31
  end
26
32
  end
27
33
  end
@@ -1,3 +1,3 @@
1
1
  module Marks
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -1201,3 +1201,195 @@ Connecting to database specified by database.yml
1201
1201
   (0.0ms) RELEASE SAVEPOINT active_record_1
1202
1202
   (0.1ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1203
1203
   (1.0ms) rollback transaction
1204
+ Connecting to database specified by database.yml
1205
+  (0.3ms) begin transaction
1206
+  (0.0ms) SAVEPOINT active_record_1
1207
+ SQL (9.8ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1208
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1209
+  (0.1ms) SAVEPOINT active_record_1
1210
+ SQL (0.9ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1211
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1212
+  (0.5ms) SELECT COUNT(*) FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1213
+  (0.1ms) SAVEPOINT active_record_1
1214
+ SQL (0.8ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1215
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1216
+  (0.0ms) SAVEPOINT active_record_1
1217
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1218
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1219
+  (0.0ms) SAVEPOINT active_record_1
1220
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1221
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1222
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1223
+  (1.0ms) rollback transaction
1224
+  (0.1ms) begin transaction
1225
+  (0.0ms) SAVEPOINT active_record_1
1226
+ SQL (0.5ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1227
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1228
+  (0.0ms) SAVEPOINT active_record_1
1229
+ SQL (0.6ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1230
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1231
+  (0.1ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1232
+  (0.0ms) SAVEPOINT active_record_1
1233
+ SQL (0.2ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Wed, 05 Dec 2012 06:16:49 UTC +00:00]]
1234
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1235
+  (0.1ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1236
+  (0.5ms) rollback transaction
1237
+ Connecting to database specified by database.yml
1238
+  (0.4ms) begin transaction
1239
+  (0.1ms) SAVEPOINT active_record_1
1240
+ SQL (8.9ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1241
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1242
+  (0.1ms) SAVEPOINT active_record_1
1243
+ SQL (0.9ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1244
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1245
+  (0.4ms) SELECT COUNT(*) FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1246
+  (0.1ms) SAVEPOINT active_record_1
1247
+ SQL (1.5ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1248
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1249
+  (0.1ms) SAVEPOINT active_record_1
1250
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1251
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1252
+  (0.0ms) SAVEPOINT active_record_1
1253
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1254
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1255
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1256
+  (0.9ms) rollback transaction
1257
+  (0.1ms) begin transaction
1258
+  (0.0ms) SAVEPOINT active_record_1
1259
+ SQL (0.5ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1260
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1261
+  (0.0ms) SAVEPOINT active_record_1
1262
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1263
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1264
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1265
+  (0.0ms) SAVEPOINT active_record_1
1266
+ SQL (0.4ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1267
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1268
+  (0.1ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1269
+  (0.5ms) rollback transaction
1270
+  (0.0ms) begin transaction
1271
+  (0.0ms) SAVEPOINT active_record_1
1272
+ SQL (0.4ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1273
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1274
+  (0.0ms) SAVEPOINT active_record_1
1275
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1276
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1277
+  (0.0ms) SAVEPOINT active_record_1
1278
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1279
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1280
+  (0.0ms) SAVEPOINT active_record_1
1281
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1282
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1283
+  (0.0ms) SAVEPOINT active_record_1
1284
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:36:55 UTC +00:00]]
1285
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1286
+ SQL (0.1ms) DELETE FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1287
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1288
+  (0.5ms) rollback transaction
1289
+ Connecting to database specified by database.yml
1290
+  (0.4ms) begin transaction
1291
+  (0.0ms) SAVEPOINT active_record_1
1292
+ SQL (4.9ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1293
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1294
+  (0.1ms) SAVEPOINT active_record_1
1295
+ SQL (0.5ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1296
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1297
+  (0.2ms) SELECT COUNT(*) FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1298
+  (0.1ms) SAVEPOINT active_record_1
1299
+ SQL (0.5ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1300
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1301
+  (0.0ms) SAVEPOINT active_record_1
1302
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1303
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1304
+  (0.0ms) SAVEPOINT active_record_1
1305
+ SQL (0.2ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1306
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1307
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1308
+  (0.5ms) rollback transaction
1309
+  (0.1ms) begin transaction
1310
+  (0.0ms) SAVEPOINT active_record_1
1311
+ SQL (0.4ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1312
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1313
+  (0.0ms) SAVEPOINT active_record_1
1314
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1315
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1316
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1317
+  (0.1ms) SAVEPOINT active_record_1
1318
+ SQL (0.4ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1319
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1320
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1321
+  (0.5ms) rollback transaction
1322
+  (0.0ms) begin transaction
1323
+  (0.0ms) SAVEPOINT active_record_1
1324
+ SQL (0.5ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1325
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1326
+  (0.0ms) SAVEPOINT active_record_1
1327
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1328
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1329
+  (0.0ms) SAVEPOINT active_record_1
1330
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1331
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1332
+  (0.0ms) SAVEPOINT active_record_1
1333
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1334
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1335
+  (0.0ms) SAVEPOINT active_record_1
1336
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:18 UTC +00:00]]
1337
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1338
+ SQL (0.2ms) DELETE FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1339
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1340
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1341
+  (0.5ms) rollback transaction
1342
+ Connecting to database specified by database.yml
1343
+  (0.4ms) begin transaction
1344
+  (0.1ms) SAVEPOINT active_record_1
1345
+ SQL (7.4ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1346
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1347
+  (0.0ms) SAVEPOINT active_record_1
1348
+ SQL (0.6ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1349
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1350
+  (0.2ms) SELECT COUNT(*) FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1351
+  (0.1ms) SAVEPOINT active_record_1
1352
+ SQL (0.5ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1353
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1354
+  (0.0ms) SAVEPOINT active_record_1
1355
+ SQL (0.2ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1356
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1357
+  (0.0ms) SAVEPOINT active_record_1
1358
+ SQL (0.2ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1359
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1360
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1361
+  (0.5ms) rollback transaction
1362
+  (0.1ms) begin transaction
1363
+  (0.0ms) SAVEPOINT active_record_1
1364
+ SQL (0.5ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1365
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1366
+  (0.0ms) SAVEPOINT active_record_1
1367
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1368
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1369
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1370
+  (0.1ms) SAVEPOINT active_record_1
1371
+ SQL (0.4ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1372
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1373
+  (0.2ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1374
+  (0.3ms) rollback transaction
1375
+  (0.1ms) begin transaction
1376
+  (0.0ms) SAVEPOINT active_record_1
1377
+ SQL (0.5ms) INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1378
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1379
+  (0.0ms) SAVEPOINT active_record_1
1380
+ SQL (0.4ms) INSERT INTO "replies" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1381
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1382
+  (0.0ms) SAVEPOINT active_record_1
1383
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1384
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1385
+  (0.0ms) SAVEPOINT active_record_1
1386
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1387
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1388
+  (0.0ms) SAVEPOINT active_record_1
1389
+ SQL (0.3ms) INSERT INTO "marks_marks" ("created_at", "mark_type", "markable_id", "markable_type", "marker_id", "marker_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["created_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00], ["mark_type", "Nice"], ["markable_id", 1], ["markable_type", "Reply"], ["marker_id", 1], ["marker_type", "User"], ["updated_at", Thu, 17 Jan 2013 09:37:27 UTC +00:00]]
1390
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1391
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1392
+ SQL (0.2ms) DELETE FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1393
+ User Load (0.2ms) SELECT "users".* FROM "users" INNER JOIN "marks_marks" ON "marks_marks"."marker_id" = "users"."id" AND "marks_marks"."marker_type" = 'User' WHERE (marks_marks.mark_type = 'Nice' AND markable_type = 'Reply' AND markable_id = 1)
1394
+  (0.1ms) SELECT COUNT(*) FROM "marks_marks" WHERE "marks_marks"."marker_id" = 1 AND "marks_marks"."marker_type" = 'User' AND "marks_marks"."mark_type" = 'Nice' AND "marks_marks"."markable_type" = 'Reply' AND "marks_marks"."markable_id" = 1
1395
+  (0.4ms) rollback transaction
@@ -19,4 +19,10 @@ class MarksTest < ActiveSupport::TestCase
19
19
  assert_equal [@user, @user, @user], @reply.markers(:user, :nice)
20
20
  assert_raise(ArgumentError) { @reply.markers(:user, :unknown_mark) }
21
21
  end
22
+
23
+ test '#unmarks' do
24
+ 3.times { @user.marks(@reply, :nice) }
25
+ @user.unmarks(@reply, :nice)
26
+ assert !@user.marks?(@reply, :nice)
27
+ end
22
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marks
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:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -356722490955600964
118
+ hash: 692714029956290424
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: -356722490955600964
127
+ hash: 692714029956290424
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.23