blueprinter 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/blueprinter/helpers/base_helpers.rb +2 -20
- data/lib/blueprinter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b6d940b46bce95ee9acbbad59aee013de76cbb59c5b920a96ba85942e484e2
|
4
|
+
data.tar.gz: 245a47f14a1951da30cc8049d73429f258dd48f70f0f93e06a9005cc25c272ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dcfb1a44682a1fb84dcf9e796bd1aba83af8b5458ade5853ff4c0aeea0bacdc47f40ce929775f9731d843d4e19eb17dd82eb5ed266271d031eea7c17e79e1c7
|
7
|
+
data.tar.gz: '0068c6c449b7be677485321d51928e92c9154e095a2ce67481f91f5e5b97771e3099de17885d5ff69535800c323c85c7dbdaabb6a12a0f56fd012ffd6b3c91a5'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.13.1 - 2019/03/02
|
2
|
+
* 💅 [MAINTENANCE | ENHANCEMENT] Cleaning up the `include_associations` section. This is not a documented/supported feature and is calling `respond_to?(:klass)` on every object passed to blueprinter. [#139](https://github.com/procore/blueprinter/pull/139). Thanks to [@ritikesh](https://github.com/ritikesh).
|
3
|
+
|
1
4
|
## 0.13.0 - 2019/02/07
|
2
5
|
|
3
6
|
* 🚀 [FEATURE] Added an option to render with a root key. [#135](https://github.com/procore/blueprinter/pull/135). Thanks to [@ritikesh](https://github.com/ritikesh).
|
@@ -20,15 +20,14 @@ module Blueprinter
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def prepare_data(object, view_name, local_options)
|
23
|
-
prepared_object = include_associations(object, view_name: view_name)
|
24
23
|
if array_like?(object)
|
25
|
-
|
24
|
+
object.map do |obj|
|
26
25
|
object_to_hash(obj,
|
27
26
|
view_name: view_name,
|
28
27
|
local_options: local_options)
|
29
28
|
end
|
30
29
|
else
|
31
|
-
object_to_hash(
|
30
|
+
object_to_hash(object,
|
32
31
|
view_name: view_name,
|
33
32
|
local_options: local_options)
|
34
33
|
end
|
@@ -62,23 +61,6 @@ module Blueprinter
|
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
|
-
def include_associations(object, view_name:)
|
66
|
-
unless defined?(ActiveRecord::Base) &&
|
67
|
-
object.is_a?(ActiveRecord::Base) &&
|
68
|
-
object.respond_to?(:klass)
|
69
|
-
return object
|
70
|
-
end
|
71
|
-
# TODO: Do we need to support more than `eager_load` ?
|
72
|
-
fields_to_include = associations(view).select { |a|
|
73
|
-
a.options[:include] != false
|
74
|
-
}.map(&:method)
|
75
|
-
if !fields_to_include.empty?
|
76
|
-
object.eager_load(*fields_to_include)
|
77
|
-
else
|
78
|
-
object
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
64
|
def jsonify(blob)
|
83
65
|
Blueprinter.configuration.jsonify(blob)
|
84
66
|
end
|
data/lib/blueprinter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueprinter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hess
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-03-
|
12
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: factory_bot
|