active_model_serializers 0.9.1 → 0.9.3
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/action_controller/serialization.rb +1 -1
- data/lib/active_model/serializer.rb +1 -1
- data/lib/active_model/serializer/version.rb +1 -1
- data/test/fixtures/poro.rb +0 -4
- data/test/integration/action_controller/serialization_test.rb +0 -16
- data/test/serializers/tmp/app/serializers/account_serializer.rb +3 -0
- metadata +26 -26
- data/test/tmp/app/serializers/account_serializer.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78c340a2e3f13f2c481239a485597b288d1bad45
|
4
|
+
data.tar.gz: 41820649a307a90c8bcae4739e3dc32a77a45711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0646d4c09ba21a4a8182c9fa01931ba619faeeefbf0dfb1492fa5f8769b6ce5c6ac2962d13b09224943191cf70e79ab8e360da5923fadc1f5eaf8213c24ea1
|
7
|
+
data.tar.gz: ab87b438037b55acf490d9ac6327abc01fed66cb06638bd12e235e0d3e3f8471a09144315762b866bba13958b60fa38dd02f9e9173d1dfff069ad310e02cec7b
|
@@ -87,7 +87,7 @@ module ActionController
|
|
87
87
|
if serializer = options.fetch(:serializer, default_serializer(resource))
|
88
88
|
options[:scope] = serialization_scope unless options.has_key?(:scope)
|
89
89
|
|
90
|
-
if resource.respond_to?(:
|
90
|
+
if resource.respond_to?(:to_ary)
|
91
91
|
options[:resource_name] = controller_name
|
92
92
|
options[:namespace] = namespace_for_serializer if namespace_for_serializer
|
93
93
|
end
|
data/test/fixtures/poro.rb
CHANGED
@@ -100,10 +100,6 @@ class ProfileSerializer < ActiveModel::Serializer
|
|
100
100
|
attributes :name, :description
|
101
101
|
end
|
102
102
|
|
103
|
-
class DifferentProfileSerializer < ActiveModel::Serializer
|
104
|
-
attributes :name
|
105
|
-
end
|
106
|
-
|
107
103
|
class CategorySerializer < ActiveModel::Serializer
|
108
104
|
attributes :name
|
109
105
|
|
@@ -283,21 +283,5 @@ module ActionController
|
|
283
283
|
assert_equal("{\"my\":[{\"name\":\"Name 1\",\"email\":\"mail@server.com\",\"profile_id\":#{@controller.user.profile.object_id}}],\"profiles\":[{\"name\":\"N1\",\"description\":\"D1\"}]}", @response.body)
|
284
284
|
end
|
285
285
|
end
|
286
|
-
|
287
|
-
class ExplicitEachSerializerWithEnumarableObjectTest < ActionController::TestCase
|
288
|
-
class MyController < ActionController::Base
|
289
|
-
def render_array
|
290
|
-
render json: [Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })].to_enum, each_serializer: DifferentProfileSerializer
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
tests MyController
|
295
|
-
|
296
|
-
def test_render_array
|
297
|
-
get :render_array
|
298
|
-
assert_equal 'application/json', @response.content_type
|
299
|
-
assert_equal '{"my":[{"name":"Name 1"}]}', @response.body
|
300
|
-
end
|
301
|
-
end
|
302
286
|
end
|
303
287
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -85,9 +85,9 @@ files:
|
|
85
85
|
- test/integration/generators/resource_generator_test.rb
|
86
86
|
- test/integration/generators/scaffold_controller_generator_test.rb
|
87
87
|
- test/integration/generators/serializer_generator_test.rb
|
88
|
+
- test/serializers/tmp/app/serializers/account_serializer.rb
|
88
89
|
- test/test_app.rb
|
89
90
|
- test/test_helper.rb
|
90
|
-
- test/tmp/app/serializers/account_serializer.rb
|
91
91
|
- test/unit/active_model/array_serializer/except_test.rb
|
92
92
|
- test/unit/active_model/array_serializer/key_format_test.rb
|
93
93
|
- test/unit/active_model/array_serializer/meta_test.rb
|
@@ -138,40 +138,40 @@ specification_version: 4
|
|
138
138
|
summary: Bringing consistency and object orientation to model serialization. Works
|
139
139
|
great for client-side MVC frameworks!
|
140
140
|
test_files:
|
141
|
-
- test/
|
142
|
-
- test/
|
143
|
-
- test/
|
141
|
+
- test/fixtures/active_record.rb
|
142
|
+
- test/fixtures/poro.rb
|
143
|
+
- test/fixtures/template.html.erb
|
144
144
|
- test/integration/action_controller/namespaced_serialization_test.rb
|
145
145
|
- test/integration/action_controller/serialization_test.rb
|
146
146
|
- test/integration/action_controller/serialization_test_case_test.rb
|
147
|
+
- test/integration/active_record/active_record_test.rb
|
147
148
|
- test/integration/generators/resource_generator_test.rb
|
148
|
-
- test/integration/generators/serializer_generator_test.rb
|
149
149
|
- test/integration/generators/scaffold_controller_generator_test.rb
|
150
|
+
- test/integration/generators/serializer_generator_test.rb
|
151
|
+
- test/serializers/tmp/app/serializers/account_serializer.rb
|
152
|
+
- test/test_app.rb
|
150
153
|
- test/test_helper.rb
|
151
154
|
- test/unit/active_model/array_serializer/except_test.rb
|
152
|
-
- test/unit/active_model/array_serializer/
|
153
|
-
- test/unit/active_model/array_serializer/only_test.rb
|
154
|
-
- test/unit/active_model/array_serializer/serialization_test.rb
|
155
|
+
- test/unit/active_model/array_serializer/key_format_test.rb
|
155
156
|
- test/unit/active_model/array_serializer/meta_test.rb
|
157
|
+
- test/unit/active_model/array_serializer/only_test.rb
|
156
158
|
- test/unit/active_model/array_serializer/root_test.rb
|
157
|
-
- test/unit/active_model/array_serializer/
|
159
|
+
- test/unit/active_model/array_serializer/scope_test.rb
|
160
|
+
- test/unit/active_model/array_serializer/serialization_test.rb
|
161
|
+
- test/unit/active_model/default_serializer_test.rb
|
162
|
+
- test/unit/active_model/serializer/associations/build_serializer_test.rb
|
163
|
+
- test/unit/active_model/serializer/associations_test.rb
|
164
|
+
- test/unit/active_model/serializer/attributes_test.rb
|
158
165
|
- test/unit/active_model/serializer/config_test.rb
|
159
|
-
- test/unit/active_model/serializer/has_one_test.rb
|
160
|
-
- test/unit/active_model/serializer/url_helpers_test.rb
|
161
|
-
- test/unit/active_model/serializer/has_many_test.rb
|
162
|
-
- test/unit/active_model/serializer/has_one_and_has_many_test.rb
|
163
166
|
- test/unit/active_model/serializer/filter_test.rb
|
164
|
-
- test/unit/active_model/serializer/scope_test.rb
|
165
|
-
- test/unit/active_model/serializer/meta_test.rb
|
166
|
-
- test/unit/active_model/serializer/root_test.rb
|
167
167
|
- test/unit/active_model/serializer/has_many_polymorphic_test.rb
|
168
|
-
- test/unit/active_model/serializer/
|
168
|
+
- test/unit/active_model/serializer/has_many_test.rb
|
169
|
+
- test/unit/active_model/serializer/has_one_and_has_many_test.rb
|
169
170
|
- test/unit/active_model/serializer/has_one_polymorphic_test.rb
|
170
|
-
- test/unit/active_model/serializer/
|
171
|
-
- test/unit/active_model/serializer/options_test.rb
|
171
|
+
- test/unit/active_model/serializer/has_one_test.rb
|
172
172
|
- test/unit/active_model/serializer/key_format_test.rb
|
173
|
-
- test/unit/active_model/serializer/
|
174
|
-
- test/unit/active_model/
|
175
|
-
- test/
|
176
|
-
- test/
|
177
|
-
- test/
|
173
|
+
- test/unit/active_model/serializer/meta_test.rb
|
174
|
+
- test/unit/active_model/serializer/options_test.rb
|
175
|
+
- test/unit/active_model/serializer/root_test.rb
|
176
|
+
- test/unit/active_model/serializer/scope_test.rb
|
177
|
+
- test/unit/active_model/serializer/url_helpers_test.rb
|