superstore 2.1.1 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb66e1d1f8009402327ad30ba1342e21ea80bc7a
4
- data.tar.gz: f9bc8954b6b27db5ee99d2a81243dd51d28751ae
3
+ metadata.gz: d340fd400d34afc915c915eaccf658743639dd74
4
+ data.tar.gz: 8c4f9958333d8ffd33d4777c21f7cfee409dddd5
5
5
  SHA512:
6
- metadata.gz: 57efc766e9cfd09a53827243b748f0121e5e829580372318fefecf3dfebca43befc44546f0fe2b5479e4a6b27a15c57391bdf4168bc9055ee966dc62f739c4de
7
- data.tar.gz: 158b2901c8ea1208067d593eda2134a6cde16e8b1a19e3e1c43eb2898b2df20b50cd1df8fcaaeba99e1382e298cbb2aefa513fc2b1692886c05f8774f96604db
6
+ metadata.gz: 86c9c2e4e6a187f62402eae73914f7f6d0d653366d16a592617a424f33ee9f237cf6e467bb35d5f19f30bb702d2d081f9ca0b394c8ea31d04037ed633567cd4f
7
+ data.tar.gz: cf54fbfccda08f8c056b8316c8c874287c8c2aa524f78e0372be68f040a354f6f664cfc22bc4be1063437870817e179c015e8818bb4e717ec6eb58aa70027ec3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # 2.1.1
2
+
3
+ Released 2016-04-01.
4
+
5
+ ## New Features
6
+
7
+ * Added a `to_ids` scoped method.
8
+
9
+ # 2.1.0
10
+
11
+ Released 2016-02-12.
12
+
13
+ ## Changed
14
+
15
+ * Associations are now ActiveRecord-based (#17)
16
+
17
+ # 2.0.1
18
+
19
+ Released 2016-02-12.
20
+
21
+ ## Fixed
22
+
23
+ * `has_many` was not working correctly.
24
+
1
25
  # 2.0.0
2
26
 
3
27
  Released 2015-12-18.
@@ -105,7 +105,7 @@ module Superstore
105
105
  end
106
106
 
107
107
  def to_ids(scope)
108
- statement = QueryBuilder.new(self, scope.select('id')).to_query
108
+ statement = QueryBuilder.new(self, scope.select(primary_key_column)).to_query
109
109
  connection.select_values(statement)
110
110
  end
111
111
 
@@ -40,9 +40,10 @@ module Superstore
40
40
 
41
41
  def find_some(ids)
42
42
  ids = ids.flatten
43
+ ids.compact!
43
44
  return [] if ids.empty?
44
45
 
45
- ids = ids.compact.map(&:to_s).uniq
46
+ ids = ids.map(&:to_s).uniq
46
47
 
47
48
  where_ids(ids).to_a
48
49
  end
data/superstore.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'superstore'
5
- s.version = '2.1.1'
5
+ s.version = '2.1.2'
6
6
  s.description = 'ActiveModel for many attributes'
7
7
  s.summary = 'JSONB ActiveModel'
8
8
  s.authors = ["Michael Koziarski", "Infogroup"]
@@ -27,6 +27,11 @@ class Superstore::FinderMethodsTest < Superstore::TestCase
27
27
  assert_equal [first_issue, second_issue], Issue.find([first_issue.id, second_issue.id])
28
28
  end
29
29
 
30
+ test 'find with nil ids' do
31
+ Issue.create
32
+ assert_equal [], Issue.find([nil])
33
+ end
34
+
30
35
  test 'find_by_id' do
31
36
  Issue.create.tap do |issue|
32
37
  assert_equal issue, Issue.find_by_id(issue.id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Koziarski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-01 00:00:00.000000000 Z
12
+ date: 2016-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel