activerecord-like 0.0.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e1d444430a4d71fcf388e809bc133ef37b6d6f2
4
- data.tar.gz: 6dbf791db767395263eb645522e5edbe65294222
3
+ metadata.gz: 7d5747b7416a46d6d651022ba3fa6924fd8db7a0
4
+ data.tar.gz: a12c215ff69771f33fc772c81c52328d553afc3e
5
5
  SHA512:
6
- metadata.gz: 66da03780c19dcd40e345e855ebffc9f22eac25402d8a872758e8d8d44022833dbe39ef1d80d3cbd5e73ca0f750f10ab0b1ba9bf2b2b98433bec80e16d3a1f68
7
- data.tar.gz: b5a30f2872aa5034fcd0ebd3933b45b6da89781d8d60f9be477034643b01004fb9e2d52feb47092be42bb973a90336e4fb2f8d710d57ac1fc7a35536ebba4f08
6
+ metadata.gz: 28e1151781fee66992b46a476bf7390f56febd409616f31af9cf41a5c1c8e2354df120fb2927bc7a12983e04db7ff34947427cb1314c6ddfe36a38dd38c468d3
7
+ data.tar.gz: bcf5e1ee0ae802a3bdbf6ea1444e720e5e2a74ad540b88cf9e538ebdf0e35586172269bc54a932d3e255ee0c11d431ace76d79b43a8d3b119ef6f5e3769f5a20
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.1
4
+ - 2.1.9
5
+ - 2.2.5
6
+ - 2.3.1
7
7
  env:
8
8
  - DB=pg
9
9
  - DB=sqlite3
data/README.md CHANGED
@@ -43,7 +43,7 @@ Post.where.not_like(title: ["%ruby%", "%rails%"])
43
43
  ```
44
44
 
45
45
  ## Dependencies
46
- Does not work with ARel 4.0.1 or lower or ARel 5.0.0. Do a `bundle update arel` to get the latest ARel that is compatible with your ActiveRecord version (4.0 for ActiveRecord 4.0, 5.0 for ActiveRecord 4.1).
46
+ Does not work with Arel 4.0.1 or lower or Arel 5.0.0. Do a `bundle update arel` to get the latest Arel that is compatible with your ActiveRecord version (4.0 for ActiveRecord 4.0, 5.0 for ActiveRecord 4.1).
47
47
 
48
48
  ## Contributing
49
49
 
@@ -4,6 +4,12 @@ module ActiveRecord
4
4
  module QueryMethods
5
5
  module Like
6
6
  def like(opts, *rest)
7
+ opts.each do |k,v|
8
+ if v.is_a?(Array) && v.empty?
9
+ opts[k] = ''
10
+ end
11
+ end
12
+
7
13
  chain_node(Arel::Nodes::Matches, opts, *rest) do |nodes|
8
14
  nodes.inject { |memo, node| Arel::Nodes::Or.new(memo, node) }
9
15
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Like
3
- VERSION = "0.0.6"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -19,10 +19,6 @@ describe ActiveRecord::QueryMethods::WhereChain do
19
19
  it "has the attribute as the left operand" do
20
20
  @relation_specifier.left.name.must_equal @attribute
21
21
  end
22
-
23
- it "has the value as the right operand" do
24
- @relation_specifier.right.must_equal @value
25
- end
26
22
  end
27
23
  end
28
24
  end
@@ -19,10 +19,6 @@ describe ActiveRecord::QueryMethods::WhereChain do
19
19
  it "has the attribute as the left operand" do
20
20
  @relation_specifier.left.name.must_equal @attribute
21
21
  end
22
-
23
- it "has the value as the right operand" do
24
- @relation_specifier.right.must_equal @value
25
- end
26
22
  end
27
23
  end
28
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-like
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René van den Berg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  requirements: []
68
68
  rubyforge_project:
69
- rubygems_version: 2.4.4
69
+ rubygems_version: 2.4.6
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: 'ActiveRecord::Like provides ActiveRecord::Base with where.like(attribute: