graphiti 1.0.alpha.24 → 1.0.alpha.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiti.rb +5 -3
- data/lib/graphiti/railtie.rb +7 -0
- data/lib/graphiti/resource/sideloading.rb +5 -1
- data/lib/graphiti/util/serializer_relationships.rb +1 -1
- data/lib/graphiti/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: 11c4f6ec02d7b26ada772125aa0a6f93adef149c
|
4
|
+
data.tar.gz: ff61a24878530f72a9347dee1666e3c00daedb9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f39008d0879c9cae9fb68f4e259603783d873983cceb93d1fd1dfc424f9a62fdf2ad803b00229ed27fe8986d4eb6ab80ac34a2c23a5a80b730e1b85bc8e6c3f
|
7
|
+
data.tar.gz: 95fd32a819cd3f40965c636dc3235c996cce23621d4881aca88f9e083801f52b3473094b637dc241b382a6573dd2ad76e8d5137384a8333c732b7b503c56871b
|
data/lib/graphiti.rb
CHANGED
@@ -130,9 +130,11 @@ module Graphiti
|
|
130
130
|
# When we add a sideload, we need to do configuration, such as
|
131
131
|
# adding the relationship to the Resource's serializer.
|
132
132
|
# However, the sideload's Resource class may not be loaded yet.
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
133
|
+
#
|
134
|
+
# This is not a problem when Rails autoloading, but is a problem
|
135
|
+
# when *eager* loading, or not using Rails.
|
136
|
+
#
|
137
|
+
# So, load every Resource class then call Graphiti.setup!
|
136
138
|
def self.setup!
|
137
139
|
resources.each do |r|
|
138
140
|
r.apply_sideloads_to_serializer
|
data/lib/graphiti/railtie.rb
CHANGED
@@ -9,6 +9,13 @@ module Graphiti
|
|
9
9
|
end
|
10
10
|
|
11
11
|
initializer 'graphiti.init' do
|
12
|
+
if ::Rails.application.config.eager_load
|
13
|
+
config.after_initialize do |app|
|
14
|
+
::Rails.application.reload_routes!
|
15
|
+
Graphiti.setup!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
12
19
|
if Mime[:jsonapi].nil? # rails 4
|
13
20
|
Mime::Type.register('application/vnd.api+json', :jsonapi)
|
14
21
|
end
|
@@ -17,7 +17,7 @@ module Graphiti
|
|
17
17
|
parent.children[name] = sideload
|
18
18
|
else
|
19
19
|
config[:sideloads][name] = sideload
|
20
|
-
apply_sideloads_to_serializer if
|
20
|
+
apply_sideloads_to_serializer if rails_autoloading?
|
21
21
|
end
|
22
22
|
sideload
|
23
23
|
end
|
@@ -104,6 +104,10 @@ module Graphiti
|
|
104
104
|
|
105
105
|
memo
|
106
106
|
end
|
107
|
+
|
108
|
+
def rails_autoloading?
|
109
|
+
defined?(::Rails) && !::Rails.application.config.eager_load
|
110
|
+
end
|
107
111
|
end
|
108
112
|
end
|
109
113
|
end
|
data/lib/graphiti/version.rb
CHANGED