where-or 0.1.1 → 0.1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/where-or.rb +12 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 570e1bbf0c33343e297c3c359928edebf9b0979e
4
- data.tar.gz: 8add070663225de7bab2a8a3786fa944b9c77ea4
3
+ metadata.gz: 7a8bfccbdf3bdfea44c956cf6d044c2a5ad2da00
4
+ data.tar.gz: 0645fe9531ecea43d7a1538ea4d42a95ca5864a8
5
5
  SHA512:
6
- metadata.gz: deb95ae420bfeb2bd809d9a70fab3113215800149f77823e846ea4019309c102b61f02925c03f4a781a04703adb95c045b5979ce7be10bba4a2af60304e58363
7
- data.tar.gz: 4a079a3599ba1e0da29f8b8cf889f00ede75c467bc0702aa4c030afe918879eeb860659026f7fa6b1f8f0e548687a5bb596ceb9024b842e58e8d9a54b015bb8e
6
+ metadata.gz: c1b550c7fd8219a42159273af1c65426da3bdde824faf1e56d875e79f6f0e13add2ae4f013c3f994aa4ceaa65a76efdd3e13f98b03b7682b1e965ab031caa77d
7
+ data.tar.gz: 172daeacff899edaabf660b6c8cd64322581bc21fc543b176e7cb5adf88f091819ee5c0f6d6a377b48f141b97f7e06bcb4b493aaf5ab25f42dd0322310d522ab
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Where or](https://github.com/rails/rails/pull/16052) function backport from Rails 5 for Rails 4.2
4
4
 
5
- Confirm works from Rails 4.2.3 to 4.2.5. [with some issues](https://github.com/Eric-Guo/where-or/issues?utf8=%E2%9C%93&q=is%3Aissue)
5
+ Confirm works from Rails 4.2.3 to 4.2.6, including for preloading
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/where-or.svg)](https://badge.fury.io/for/rb/where-or)
8
8
 
data/lib/where-or.rb CHANGED
@@ -86,7 +86,7 @@ ActiveSupport.on_load(:active_record) do
86
86
 
87
87
  private def structurally_compatible_for_or?(other) # :nodoc:
88
88
  (ActiveRecord::Relation::SINGLE_VALUE_METHODS - [:from]).all? { |m| send("#{m}_value") == other.send("#{m}_value") } &&
89
- (ActiveRecord::Relation::MULTI_VALUE_METHODS - [:extending, :where, :having, :bind]).all? { |m| send("#{m}_values") == other.send("#{m}_values") }
89
+ (ActiveRecord::Relation::MULTI_VALUE_METHODS - [:references, :eager_load, :extending, :where, :having, :bind]).all? { |m| send("#{m}_values") == other.send("#{m}_values") }
90
90
  # https://github.com/rails/rails/commit/2c46d6db4feaf4284415f2fb6ceceb1bb535f278
91
91
  # https://github.com/rails/rails/commit/39f2c3b3ea6fac371e79c284494e3d4cfdc1e929
92
92
  # https://github.com/rails/rails/commit/bdc5141652770fd227455681cde1f9899f55b0b9
@@ -270,4 +270,15 @@ ActiveSupport.on_load(:active_record) do
270
270
  end
271
271
 
272
272
  end
273
+
274
+ class Arel::Visitors::Visitor
275
+ def visit_ActiveRecord_Relation_WhereClause o, collector
276
+ if o.binds
277
+ visit_Arel_Nodes_And(o.ast, collector)
278
+ else
279
+ collector << '1=1' # no-op
280
+ collector
281
+ end
282
+ end
283
+ end
273
284
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where-or
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Fleischer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-12 00:00:00.000000000 Z
12
+ date: 2016-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 2.4.8
65
+ rubygems_version: 2.6.4
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Where or function backport from Rails 5 for Rails 4.2