active_record-json_associations 0.6.1 → 0.6.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: de7cfd1cc8c6993a35a44e4a103d3313005a1064
4
- data.tar.gz: 480166d6d9dab02b0f7b37c2fa8a83e2bdb7c173
3
+ metadata.gz: 104232cfff6f8890c439884dc7947734c5e68286
4
+ data.tar.gz: 5a5d497ff55c46a75164df58857ab6a73ba07ba2
5
5
  SHA512:
6
- metadata.gz: 9516148ab0feaaa0fa7b479a8537433edc2f1ff6aa79a18a6c35ddd84df6407410b04fa829c17cfbaca65060a019646af03c673dbc701c4c8d9a08fb8b1653e6
7
- data.tar.gz: b67c141cbd15fd88597fded87da325ff427a235e9b48ab5e6dfab2785319a7772132bc9017db61ba70be336ce57b8ec485b50e5d3ae0df1a207064c96ec02c2d
6
+ metadata.gz: 3f9186e895cf92be3e1ab85a2b41be00e6979a0c4916b3cacb7af15a0d76b7d6dd6a8d32ca24b2b64218685aef646609b6e0a5eb6623ad6aa63b667451399ae9
7
+ data.tar.gz: dddbb32c0182d9cee3475d87913cd696f6aaa338af1cddf0691cb701043c8a3c7490b395a1f659492d1370e119042928af0cc10d7ede7af01661cf0283ac9524
@@ -19,6 +19,10 @@ module ActiveRecord
19
19
  super() || []
20
20
  end
21
21
 
22
+ define_method one_ids_equals do |ids|
23
+ super Array(ids).map(&:to_i)
24
+ end
25
+
22
26
  define_method many do
23
27
  klass = class_name.constantize
24
28
  klass.where(id: send(one_ids))
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module JsonAssociations
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
5
5
  end
@@ -45,6 +45,13 @@ describe ActiveRecord::JsonAssociations do
45
45
  end
46
46
  end
47
47
 
48
+ describe "#child_ids=" do
49
+ it "normalizes to integers" do
50
+ subject.child_ids = ["1",2,"3"]
51
+ expect(subject.child_ids).to eq [1,2,3]
52
+ end
53
+ end
54
+
48
55
  describe "#children" do
49
56
  let(:children) { [Child.create!, Child.create!, Child.create!] }
50
57
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-json_associations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord