duck_record 0.0.25 → 0.0.26

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: 2d19663344eb4aa892dd369cda75cc59da67b7e3
4
- data.tar.gz: 188bf00418075e218d1ec4df018c1bd46a694a8e
3
+ metadata.gz: 5c60a2c907aa9a22ad192c994a66556ac592feeb
4
+ data.tar.gz: f7b7f5170b02163d523382d6d8345b37a6119c6d
5
5
  SHA512:
6
- metadata.gz: c00ca372657108f0bb63c0c697f57704cb3b2c1fba0d3586588883779dba371505cafe12a60ed69406a9d19424e5a6b4b10f9cfa909463ebed4f49e9b3edc826
7
- data.tar.gz: 6de741eb0250fba42ae8d0812940d7056329714fc4d48c8b11fb3fd66083f17f1aa221454479c2af9f51a65f120a661944e9b259abcab2be0a8516d422af4562
6
+ metadata.gz: f0d27e1d7a536532a86567579c2fe3951378251dc8f6b920d620a21245700abe0693d5b149ee9a3a351985ba3c4e0e774f32206b7fc833694baff24b15941e35
7
+ data.tar.gz: 797cb8c2df95a6ba32846f7bbd7258627eadd2ac46fe49b1b81bc5d4a88a69802058b9ec4ed372e52e08f2e03271fd652bda3f188b8eceac054db727d6f9e997
@@ -90,9 +90,11 @@ module DuckRecord
90
90
  # by scope.scoping { ... } or with_scope { ... } etc, which affects the scope which
91
91
  # actually gets built.
92
92
  def association_scope
93
- if klass
94
- @association_scope ||= ActiveRecord::Associations::AssociationScope.scope(self, klass.connection)
95
- end
93
+ return unless klass
94
+
95
+ @association_scope ||= ActiveRecord::Associations::AssociationScope.scope(self)
96
+ rescue ArgumentError
97
+ @association_scope ||= ActiveRecord::Associations::AssociationScope.scope(self, klass.connection)
96
98
  end
97
99
 
98
100
  def reset_scope
@@ -116,6 +118,8 @@ module DuckRecord
116
118
  # Can be overridden (i.e. in ThroughAssociation) to merge in other scopes (i.e. the
117
119
  # through association's scope)
118
120
  def target_scope
121
+ ActiveRecord::AssociationRelation.create(klass, self).merge!(klass.all)
122
+ rescue ArgumentError
119
123
  ActiveRecord::AssociationRelation.create(klass, klass.arel_table, klass.predicate_builder, self).merge!(klass.all)
120
124
  end
121
125
 
@@ -1,3 +1,3 @@
1
1
  module DuckRecord
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duck_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-22 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport