graphiti 1.0.alpha.16 → 1.0.alpha.17
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c143ac6d83e9869c7348b95bbe5dfb7d749f5350
|
4
|
+
data.tar.gz: 68962230d384cbc40bda6ebca1bc92694edf50b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d808239bc90833c4866ba40eb5f16e4f7ad711dcbcdf3ea2570603a339e46e65f2a574682e397d8ca901b2dc4365c6d54d51314706e0d18b89c9444096a4ea7c
|
7
|
+
data.tar.gz: 1aaaec7b0f0a5a179e595d8147f7eef5baa60f8690aa4731fcbbef1a0a9f392143b65ed9d21b50ed82f6157ca586ded103e565717f143c8383d1b3327ef385be
|
data/lib/graphiti/errors.rb
CHANGED
@@ -257,7 +257,7 @@ Only one resource can be associated to a given url/verb combination.
|
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
260
|
-
class
|
260
|
+
class PolymorphicResourceChildNotFound < Base
|
261
261
|
def initialize(resource_class, model)
|
262
262
|
@resource_class = resource_class
|
263
263
|
@model = model
|
@@ -265,10 +265,11 @@ Only one resource can be associated to a given url/verb combination.
|
|
265
265
|
|
266
266
|
def message
|
267
267
|
<<-MSG
|
268
|
-
#{@resource_class}: Tried to find subclass with model #{@model.class}, but nothing found!
|
268
|
+
#{@resource_class}: Tried to find Resource subclass with model #{@model.class}, but nothing found!
|
269
269
|
|
270
270
|
Make sure all your child classes are assigned and associated to the right models:
|
271
271
|
|
272
|
+
# One of these should be assocated to model #{@model.class}:
|
272
273
|
self.polymorphic = ['Subclass1Resource', 'Subclass2Resource']
|
273
274
|
MSG
|
274
275
|
end
|
@@ -369,7 +370,7 @@ Valid types are: #{Graphiti::Types.map.keys.inspect}
|
|
369
370
|
end
|
370
371
|
end
|
371
372
|
|
372
|
-
class
|
373
|
+
class PolymorphicSideloadChildNotFound < Base
|
373
374
|
def initialize(sideload, name)
|
374
375
|
@sideload = sideload
|
375
376
|
@name = name
|
@@ -58,7 +58,7 @@ module Graphiti
|
|
58
58
|
def resource_for_model(model)
|
59
59
|
resource = children.find { |c| model.is_a?(c.model) }
|
60
60
|
if resource.nil?
|
61
|
-
raise Errors::
|
61
|
+
raise Errors::PolymorphicResourceChildNotFound.new(self, model)
|
62
62
|
else
|
63
63
|
resource
|
64
64
|
end
|
@@ -87,7 +87,7 @@ class Graphiti::Sideload::PolymorphicBelongsTo < Graphiti::Sideload::BelongsTo
|
|
87
87
|
query = remove_invalid_sideloads(sideload.resource, query)
|
88
88
|
sideload.resolve(group, query)
|
89
89
|
else
|
90
|
-
err = ::Graphiti::Errors::
|
90
|
+
err = ::Graphiti::Errors::PolymorphicSideloadChildNotFound
|
91
91
|
raise err.new(self, group_name)
|
92
92
|
end
|
93
93
|
end
|
data/lib/graphiti/version.rb
CHANGED