ocean-rails 1.30.1 → 2.0.0
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: 8d50f55650536248f495678bc60191b637fea7b5
|
4
|
+
data.tar.gz: 8924c3a57ae0ed5098015df1471a1858c15aa86f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89c81188c0778ff56b56a0278b09e3ab215208e425f14a9a118151836404d6d1ddeb64a88b0c8a7b44c0aab917dbb850b243056fbfcd70a1d371c3d91e92772a
|
7
|
+
data.tar.gz: 98370a8598bf8716a4b77362062637fc1d80f24d25d97eba8434eecf5a3b39ad3f74ba0eb77beba05c9d990e33036d641e392c10377b79607cf08cb23252a083
|
@@ -37,7 +37,13 @@ describe <%= class_name.pluralize %>Controller do
|
|
37
37
|
it "should return a collection" do
|
38
38
|
get :index
|
39
39
|
response.status.should == 200
|
40
|
-
JSON.parse(response.body)
|
40
|
+
wrapper = JSON.parse(response.body)
|
41
|
+
wrapper.should be_a Hash
|
42
|
+
resource = wrapper['_collection']
|
43
|
+
resource.should be_a Hash
|
44
|
+
coll = resource['resources']
|
45
|
+
coll.should be_an Array
|
46
|
+
coll.count.should == 3
|
41
47
|
end
|
42
48
|
|
43
49
|
end
|
@@ -174,9 +174,14 @@ module OceanApplicationController
|
|
174
174
|
end
|
175
175
|
return
|
176
176
|
else
|
177
|
-
|
178
|
-
|
179
|
-
|
177
|
+
resources = x.collect { |m| render_to_string(partial: m.to_partial_path,
|
178
|
+
locals: {m.class.model_name.i18n_key => m}) }
|
179
|
+
attrs = {count: resources.count}
|
180
|
+
render text: '{"_collection":{"resources":[' + resources.join(',') + ']' +
|
181
|
+
(attrs.collect do |k, v|
|
182
|
+
',"' + k.to_s + '":' + v.to_s
|
183
|
+
end).join('') +
|
184
|
+
'}}'
|
180
185
|
end
|
181
186
|
end
|
182
187
|
|
data/lib/ocean/version.rb
CHANGED