activerecord_nested_scope 1.0.3 → 1.0.4

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: a44db3d31ebd21c792a4c2c1780760983cc2f038
4
- data.tar.gz: 3def58069b0d7bdeda2b9169a92ce4d8880e7795
3
+ metadata.gz: 8e410ad54617ffeb9efb8f56397f72ace4642944
4
+ data.tar.gz: 8c67e79ea1bd658e73637174c011bf6ab037539e
5
5
  SHA512:
6
- metadata.gz: d65049d12b954f31efd9be805176b335960852bb2e52127a031c11b29847c72ef24985241a5c7ff6cb959b1c9908cd68d934a2e6f25b72666c59a36fc018891c
7
- data.tar.gz: 011aaa35c227300d9c13748b51638eccc3c41830222bc1f4f357e16d9a4350fe59a238b5660c6641720565b17b411fb34b6b21387a9a17c1b85202aeac9b7b9c
6
+ metadata.gz: d280f90f2b40e2668406147cb2913654784e89685923a4b36cc1764530826c8c63ff3e698dbebea4ca53ef075ab7bf98e99a4097f22d4df819d2abdace93cc18
7
+ data.tar.gz: 979cb3d3d2c9fdaef9cd6f5feb094eab90c94df90a1fb13703445056bec510134a9d50ccd448d4a2e7d8d693b0a532b817ebe93b3f6b6c7b194aabea27b0b91b
@@ -68,12 +68,12 @@ module ActiveRecordNestedScope
68
68
  end
69
69
 
70
70
  def root_relation(klass)
71
- if @args.is_a?(Integer) || @args.is_a?(Array) || @args.is_a?(ActiveRecord::Base)
72
- klass.where(klass.primary_key => @args)
73
- elsif @args.is_a?(ActiveRecord::Relation)
71
+ if @args.is_a?(ActiveRecord::Relation)
74
72
  klass.all.merge(@args)
75
- elsif @args
73
+ elsif @args.is_a?(Hash)
76
74
  klass.where(@args)
75
+ elsif @args
76
+ klass.where(klass.primary_key => @args)
77
77
  else
78
78
  klass.all
79
79
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordNestedScope
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_nested_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord