activerecord_any_of 1.0.1 → 1.0.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb1c3bc8c812cafeac5742eda463f36a1517336
|
4
|
+
data.tar.gz: 9e1c425f8faf771056efa3af3c38dcec05ed7353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9093159a107a57d4f94e01aaea598e8e66f37b138e7d211be6bdd60f0946d22d98253d2a00999a8783b78d4d131687dbf9305e86f7c448d3529cd38ec3928277
|
7
|
+
data.tar.gz: a18604f93e8fb7ba4fca299a2c376a16a9e641109bb37edcc6b2ec267924ac7a80bc2d97e6160d6542b92afa3698ed6804031d8b4982cb94362703b9a26036fd
|
@@ -66,7 +66,7 @@ module ActiverecordAnyOf
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def with_statement_cache
|
69
|
-
if queries_bind_values.any?
|
69
|
+
if queries && queries_bind_values.any?
|
70
70
|
relation = where([queries.reduce(:or).to_sql, *queries_bind_values.map { |v| v[1] }])
|
71
71
|
else
|
72
72
|
relation = where(queries.reduce(:or).to_sql)
|
@@ -86,13 +86,13 @@ module ActiverecordAnyOf
|
|
86
86
|
|
87
87
|
def with_statement_cache
|
88
88
|
if Rails.version >= '4'
|
89
|
-
if queries_bind_values.any?
|
89
|
+
if queries && queries_bind_values.any?
|
90
90
|
relation = where.not([queries.reduce(:or).to_sql, *queries_bind_values.map { |v| v[1] }])
|
91
91
|
else
|
92
92
|
relation = where.not(queries.reduce(:or).to_sql)
|
93
93
|
end
|
94
94
|
else
|
95
|
-
if queries_bind_values.any?
|
95
|
+
if queries && queries_bind_values.any?
|
96
96
|
relation = where([Arel::Nodes::Not.new(queries.reduce(:or)).to_sql, *queries_bind_values.map { |v| v[1] }])
|
97
97
|
else
|
98
98
|
relation = where(Arel::Nodes::Not.new(queries.reduce(:or)).to_sql)
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -2489,3 +2489,99 @@ Connecting to database specified by database.yml
|
|
2489
2489
|
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE "authors"."name" = 'David' LIMIT 1[0m
|
2490
2490
|
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1 AND (NOT (("posts"."author_id" = 1 AND "posts"."body" = 'Such a lovely day' OR "posts"."author_id" = 1 AND "posts"."type" = 'SpecialPost')))
|
2491
2491
|
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2492
|
+
Connecting to database specified by database.yml
|
2493
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
2494
|
+
[1m[35mFixture Delete (0.2ms)[0m DELETE FROM "authors"
|
2495
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (1, 'David', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2496
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (2, 'Mary', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2497
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (3, 'Bob', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2498
|
+
[1m[35mFixture Delete (0.0ms)[0m DELETE FROM "posts"
|
2499
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (1, 1, 'Welcome to the weblog', 'Such a lovely day', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2500
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (2, 1, 'So I was thinking', 'Like I hopefully always am', 'SpecialPost', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2501
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (3, 0, 'I don''t have any comments', 'I just don''t want to', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2502
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (4, 1, 'sti comments', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2503
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (5, 1, 'sti me', 'hello', 'StiPost', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2504
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (6, 1, 'habtm sti test', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2505
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (7, 2, 'eager loading with OR''d conditions', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2506
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (8, 3, 'misc post by bob', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2507
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (9, 2, 'misc post by mary', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2508
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (10, 3, 'other post by bob', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')
|
2509
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (11, 2, 'other post by mary', 'hello', 'Post', '2013-08-30 17:04:37', '2013-08-30 17:04:37')[0m
|
2510
|
+
[1m[35m (279.5ms)[0m commit transaction
|
2511
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2512
|
+
[1m[35mAuthor Load (0.2ms)[0m SELECT "authors".* FROM "authors" WHERE (name like '%av%') AND (("authors"."name" = 'David' AND (name like '%av%') OR "authors"."name" = 'Mary' AND (name like '%av%')))
|
2513
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2514
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2515
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2516
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2517
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2518
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2519
|
+
[1m[36mAuthor Load (0.1ms)[0m [1mSELECT "authors".* FROM "authors" INNER JOIN "posts" ON "posts"."author_id" = "authors"."id" WHERE (("posts"."title" = 'Welcome to the weblog' OR "posts"."title" = 'eager loading with OR''d conditions'))[0m
|
2520
|
+
[1m[35mSQL (0.1ms)[0m SELECT "authors"."id" AS t0_r0, "authors"."name" AS t0_r1, "authors"."created_at" AS t0_r2, "authors"."updated_at" AS t0_r3, "posts"."id" AS t1_r0, "posts"."title" AS t1_r1, "posts"."body" AS t1_r2, "posts"."author_id" AS t1_r3, "posts"."type" AS t1_r4, "posts"."created_at" AS t1_r5, "posts"."updated_at" AS t1_r6 FROM "authors" LEFT OUTER JOIN "posts" ON "posts"."author_id" = "authors"."id" WHERE (("posts"."title" = 'Welcome to the weblog' OR "posts"."title" = 'eager loading with OR''d conditions'))
|
2521
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2522
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2523
|
+
[1m[36mAuthor Load (0.1ms)[0m [1mSELECT "authors".* FROM "authors" WHERE (("authors"."name" = 'David' OR "authors"."name" = 'Mary'))[0m
|
2524
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE (("authors"."name" = 'David' OR (name = 'Mary')))
|
2525
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE ((("authors"."name" = 'David' OR (name = 'Mary')) OR "authors"."name" = 'Bob'))[0m
|
2526
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE ((("authors"."name" = 'David' OR (name = 'Mary')) OR "authors"."name" = 'Bob' AND "authors"."id" = 3))
|
2527
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE (name IS NOT 'Mary') AND (("authors"."name" = 'David' OR (name IS NOT 'Mary') AND (name = 'Mary')))[0m
|
2528
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2529
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2530
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE "authors"."name" = 'David' LIMIT 1
|
2531
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1 AND (("posts"."author_id" = 1 AND "posts"."body" = 'Such a lovely day' OR "posts"."author_id" = 1 AND "posts"."type" = 'SpecialPost'))[0m
|
2532
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2533
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2534
|
+
[1m[35mAuthor Load (0.1ms)[0m SELECT "authors".* FROM "authors" WHERE (NOT (("authors"."name" = 'David' OR "authors"."name" = 'Mary')))
|
2535
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2536
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2537
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE "authors"."name" = 'David' LIMIT 1[0m
|
2538
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1 AND (NOT (("posts"."author_id" = 1 AND "posts"."body" = 'Such a lovely day' OR "posts"."author_id" = 1 AND "posts"."type" = 'SpecialPost')))
|
2539
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2540
|
+
Connecting to database specified by database.yml
|
2541
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
2542
|
+
[1m[35mFixture Delete (0.1ms)[0m DELETE FROM "authors"
|
2543
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (1, 'David', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2544
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (2, 'Mary', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2545
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "authors" ("id", "name", "created_at", "updated_at") VALUES (3, 'Bob', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2546
|
+
[1m[35mFixture Delete (0.0ms)[0m DELETE FROM "posts"
|
2547
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (1, 1, 'Welcome to the weblog', 'Such a lovely day', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2548
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (2, 1, 'So I was thinking', 'Like I hopefully always am', 'SpecialPost', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2549
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (3, 0, 'I don''t have any comments', 'I just don''t want to', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2550
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (4, 1, 'sti comments', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2551
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (5, 1, 'sti me', 'hello', 'StiPost', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2552
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (6, 1, 'habtm sti test', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2553
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (7, 2, 'eager loading with OR''d conditions', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2554
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (8, 3, 'misc post by bob', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2555
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (9, 2, 'misc post by mary', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2556
|
+
[1m[35mFixture Insert (0.0ms)[0m INSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (10, 3, 'other post by bob', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')
|
2557
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "posts" ("id", "author_id", "title", "body", "type", "created_at", "updated_at") VALUES (11, 2, 'other post by mary', 'hello', 'Post', '2013-08-30 17:24:41', '2013-08-30 17:24:41')[0m
|
2558
|
+
[1m[35m (808.0ms)[0m commit transaction
|
2559
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2560
|
+
[1m[35mAuthor Load (0.2ms)[0m SELECT "authors".* FROM "authors" WHERE (name like '%av%') AND (("authors"."name" = 'David' AND (name like '%av%') OR "authors"."name" = 'Mary' AND (name like '%av%')))
|
2561
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2562
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2563
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2564
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2565
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2566
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2567
|
+
[1m[36mAuthor Load (0.1ms)[0m [1mSELECT "authors".* FROM "authors" INNER JOIN "posts" ON "posts"."author_id" = "authors"."id" WHERE (("posts"."title" = 'Welcome to the weblog' OR "posts"."title" = 'eager loading with OR''d conditions'))[0m
|
2568
|
+
[1m[35mSQL (0.1ms)[0m SELECT "authors"."id" AS t0_r0, "authors"."name" AS t0_r1, "authors"."created_at" AS t0_r2, "authors"."updated_at" AS t0_r3, "posts"."id" AS t1_r0, "posts"."title" AS t1_r1, "posts"."body" AS t1_r2, "posts"."author_id" AS t1_r3, "posts"."type" AS t1_r4, "posts"."created_at" AS t1_r5, "posts"."updated_at" AS t1_r6 FROM "authors" LEFT OUTER JOIN "posts" ON "posts"."author_id" = "authors"."id" WHERE (("posts"."title" = 'Welcome to the weblog' OR "posts"."title" = 'eager loading with OR''d conditions'))
|
2569
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2570
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2571
|
+
[1m[36mAuthor Load (0.1ms)[0m [1mSELECT "authors".* FROM "authors" WHERE (("authors"."name" = 'David' OR "authors"."name" = 'Mary'))[0m
|
2572
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE (("authors"."name" = 'David' OR (name = 'Mary')))
|
2573
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE ((("authors"."name" = 'David' OR (name = 'Mary')) OR "authors"."name" = 'Bob'))[0m
|
2574
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE ((("authors"."name" = 'David' OR (name = 'Mary')) OR "authors"."name" = 'Bob' AND "authors"."id" = 3))
|
2575
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE (name IS NOT 'Mary') AND (("authors"."name" = 'David' OR (name IS NOT 'Mary') AND (name = 'Mary')))[0m
|
2576
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2577
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2578
|
+
[1m[35mAuthor Load (0.0ms)[0m SELECT "authors".* FROM "authors" WHERE "authors"."name" = 'David' LIMIT 1
|
2579
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1 AND (("posts"."author_id" = 1 AND "posts"."body" = 'Such a lovely day' OR "posts"."author_id" = 1 AND "posts"."type" = 'SpecialPost'))[0m
|
2580
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2581
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2582
|
+
[1m[35mAuthor Load (0.1ms)[0m SELECT "authors".* FROM "authors" WHERE (NOT (("authors"."name" = 'David' OR "authors"."name" = 'Mary')))
|
2583
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
2584
|
+
[1m[35m (0.0ms)[0m begin transaction
|
2585
|
+
[1m[36mAuthor Load (0.0ms)[0m [1mSELECT "authors".* FROM "authors" WHERE "authors"."name" = 'David' LIMIT 1[0m
|
2586
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 1 AND (NOT (("posts"."author_id" = 1 AND "posts"."body" = 'Such a lovely day' OR "posts"."author_id" = 1 AND "posts"."type" = 'SpecialPost')))
|
2587
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|