fields-serializer 0.5.1 → 0.5.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 +4 -4
- data/lib/fields/serializer/active_record.rb +5 -4
- data/lib/fields/serializer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 443eca2a66daab0162582536e8326a7d5b7b3c97
|
4
|
+
data.tar.gz: 81f71c018cc3c5f07a4937a59db442ad53822996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20b507a9cb95489b542cef6603e328749e85e415af3ba36fd85836810061cec9e21443a88627399ecc1f9c3676078a9721d6931da0fd4ab0d1b5808feca422a8
|
7
|
+
data.tar.gz: 9a2f3c2dd43ca801ee951012a455fa441c2d3d3b615fa64d1c0e270f9795cface7a96a95ee067255ee6d094319e8c17cd2ed5613f2e9b4b1f2424c05eefcc4f9
|
@@ -7,6 +7,11 @@ module Fields
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
class_methods do
|
10
|
+
|
11
|
+
def association?(key)
|
12
|
+
reflections.keys.include?(key)
|
13
|
+
end
|
14
|
+
|
10
15
|
# Convert a list of fields (json_api notation) in a list of associations to be
|
11
16
|
# added to a ActiveRecord Model.includes call
|
12
17
|
#
|
@@ -58,10 +63,6 @@ module Fields
|
|
58
63
|
def array_fields(fields)
|
59
64
|
Array(fields).map { |str| str.to_s.split(",").map(&:strip) }.flatten.sort
|
60
65
|
end
|
61
|
-
|
62
|
-
def association?(key)
|
63
|
-
reflections.keys.include?(key)
|
64
|
-
end
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end
|