duck_record 0.0.25 → 0.0.26
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 +4 -4
- data/lib/duck_record/associations/association.rb +7 -3
- data/lib/duck_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c60a2c907aa9a22ad192c994a66556ac592feeb
|
|
4
|
+
data.tar.gz: f7b7f5170b02163d523382d6d8345b37a6119c6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
data/lib/duck_record/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|