active_record-json_associations 0.6.2 → 0.6.3

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: 104232cfff6f8890c439884dc7947734c5e68286
4
- data.tar.gz: 5a5d497ff55c46a75164df58857ab6a73ba07ba2
3
+ metadata.gz: f910924a4b7db4fbb8b85ae587d920bd6d3dd443
4
+ data.tar.gz: 29b868a54bf20c8a0aac20273d0b03555bb7dd44
5
5
  SHA512:
6
- metadata.gz: 3f9186e895cf92be3e1ab85a2b41be00e6979a0c4916b3cacb7af15a0d76b7d6dd6a8d32ca24b2b64218685aef646609b6e0a5eb6623ad6aa63b667451399ae9
7
- data.tar.gz: dddbb32c0182d9cee3475d87913cd696f6aaa338af1cddf0691cb701043c8a3c7490b395a1f659492d1370e119042928af0cc10d7ede7af01661cf0283ac9524
6
+ metadata.gz: 3fdbaf90f761a9c81cc43468abc4b6c004e3c1ddac60be7eb97420f4b65e930dffc80ba09b320614006ae07934a0d5549772947e50d0f56f6d9b21722963ccbc
7
+ data.tar.gz: b1675d6693fb78632dfef7a9c021fad62370ed0068bbefd7fd16f1690cb16d22296617a12d856f23eaad562bb0ccc4337556c92bd9005cbd88677e61636a1e84
@@ -39,7 +39,7 @@ module ActiveRecord
39
39
  end
40
40
 
41
41
  def has_many many, scope = nil, options = {}, &extension
42
- unless scope.try(:[], :json_foreign_key) || options.try(:[], :json_foreign_key)
42
+ unless (scope.is_a?(Hash) && scope[:json_foreign_key]) || (options.is_a?(Hash) && options[:json_foreign_key])
43
43
  return super
44
44
  end
45
45
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module JsonAssociations
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
@@ -28,6 +28,11 @@ describe ActiveRecord::JsonAssociations do
28
28
 
29
29
  class Pet < ActiveRecord::Base
30
30
  has_many :parents, json_foreign_key: :fuzzy_ids
31
+
32
+ # ensure that regular .has_many invocations still work
33
+ has_many :fallback_parents
34
+ has_many :fallback_parents_with_options, class_name: "Pet"
35
+ has_many :fallback_parents_with_scope, -> { order(:id) }
31
36
  end
32
37
  end
33
38
 
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.2
4
+ version: 0.6.3
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-03-07 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord