active_model_serializers 0.10.0.rc3 → 0.10.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +37 -33
  4. data/.rubocop_todo.yml +13 -88
  5. data/.simplecov +23 -11
  6. data/.travis.yml +17 -12
  7. data/CHANGELOG.md +417 -12
  8. data/CONTRIBUTING.md +206 -17
  9. data/Gemfile +12 -11
  10. data/README.md +78 -286
  11. data/Rakefile +44 -8
  12. data/active_model_serializers.gemspec +9 -1
  13. data/appveyor.yml +6 -4
  14. data/docs/ARCHITECTURE.md +120 -0
  15. data/docs/DESIGN.textile +8 -0
  16. data/docs/README.md +21 -15
  17. data/docs/general/adapters.md +79 -27
  18. data/docs/general/caching.md +52 -0
  19. data/docs/general/configuration_options.md +18 -2
  20. data/docs/general/getting_started.md +44 -19
  21. data/docs/general/instrumentation.md +40 -0
  22. data/docs/general/logging.md +14 -0
  23. data/docs/general/rendering.md +153 -0
  24. data/docs/general/serializers.md +207 -0
  25. data/docs/how-open-source-maintained.jpg +0 -0
  26. data/docs/howto/add_pagination_links.md +16 -7
  27. data/docs/howto/add_root_key.md +3 -3
  28. data/docs/howto/outside_controller_use.md +25 -9
  29. data/docs/howto/test.md +152 -0
  30. data/docs/integrations/ember-and-json-api.md +112 -0
  31. data/docs/integrations/grape.md +19 -0
  32. data/docs/jsonapi/schema.md +140 -0
  33. data/docs/jsonapi/schema/schema.json +366 -0
  34. data/lib/action_controller/serialization.rb +13 -9
  35. data/lib/active_model/serializable_resource.rb +9 -7
  36. data/lib/active_model/serializer.rb +93 -129
  37. data/lib/active_model/serializer/adapter.rb +37 -105
  38. data/lib/active_model/serializer/adapter/attributes.rb +66 -0
  39. data/lib/active_model/serializer/adapter/base.rb +58 -0
  40. data/lib/active_model/serializer/adapter/cached_serializer.rb +45 -0
  41. data/lib/active_model/serializer/adapter/fragment_cache.rb +43 -7
  42. data/lib/active_model/serializer/adapter/json.rb +11 -37
  43. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +9 -1
  44. data/lib/active_model/serializer/adapter/json_api.rb +127 -62
  45. data/lib/active_model/serializer/adapter/json_api/deserialization.rb +207 -0
  46. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +9 -1
  47. data/lib/active_model/serializer/adapter/json_api/link.rb +44 -0
  48. data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +12 -4
  49. data/lib/active_model/serializer/adapter/null.rb +7 -1
  50. data/lib/active_model/serializer/array_serializer.rb +6 -37
  51. data/lib/active_model/serializer/associations.rb +21 -18
  52. data/lib/active_model/serializer/attribute.rb +25 -0
  53. data/lib/active_model/serializer/attributes.rb +82 -0
  54. data/lib/active_model/serializer/caching.rb +100 -0
  55. data/lib/active_model/serializer/collection_serializer.rb +47 -0
  56. data/lib/active_model/serializer/configuration.rb +17 -3
  57. data/lib/active_model/serializer/field.rb +56 -0
  58. data/lib/active_model/serializer/fieldset.rb +9 -18
  59. data/lib/active_model/serializer/include_tree.rb +111 -0
  60. data/lib/active_model/serializer/links.rb +33 -0
  61. data/lib/active_model/serializer/lint.rb +16 -3
  62. data/lib/active_model/serializer/reflection.rb +25 -8
  63. data/lib/active_model/serializer/type.rb +25 -0
  64. data/lib/active_model/serializer/version.rb +1 -1
  65. data/lib/active_model_serializers.rb +16 -26
  66. data/lib/active_model_serializers/callbacks.rb +55 -0
  67. data/lib/active_model_serializers/deserialization.rb +13 -0
  68. data/lib/active_model_serializers/logging.rb +119 -0
  69. data/lib/active_model_serializers/model.rb +39 -0
  70. data/lib/active_model_serializers/railtie.rb +38 -0
  71. data/lib/active_model_serializers/serialization_context.rb +10 -0
  72. data/lib/active_model_serializers/test.rb +7 -0
  73. data/lib/active_model_serializers/test/schema.rb +103 -0
  74. data/lib/active_model_serializers/test/serializer.rb +125 -0
  75. data/lib/generators/{serializer → rails}/USAGE +1 -1
  76. data/lib/generators/{serializer → rails}/resource_override.rb +1 -3
  77. data/lib/generators/{serializer → rails}/serializer_generator.rb +2 -3
  78. data/lib/generators/{serializer → rails}/templates/serializer.rb.erb +0 -0
  79. data/lib/grape/active_model_serializers.rb +14 -0
  80. data/lib/grape/formatters/active_model_serializers.rb +15 -0
  81. data/lib/grape/helpers/active_model_serializers.rb +16 -0
  82. data/test/action_controller/adapter_selector_test.rb +1 -1
  83. data/test/action_controller/json/include_test.rb +167 -0
  84. data/test/action_controller/json_api/deserialization_test.rb +59 -0
  85. data/test/action_controller/json_api/linked_test.rb +20 -3
  86. data/test/action_controller/json_api/pagination_test.rb +7 -7
  87. data/test/action_controller/serialization_scope_name_test.rb +8 -12
  88. data/test/action_controller/serialization_test.rb +44 -29
  89. data/test/active_model_serializers/logging_test.rb +77 -0
  90. data/test/active_model_serializers/model_test.rb +9 -0
  91. data/test/active_model_serializers/railtie_test_isolated.rb +57 -0
  92. data/test/active_model_serializers/serialization_context_test.rb +18 -0
  93. data/test/active_model_serializers/test/schema_test.rb +128 -0
  94. data/test/active_model_serializers/test/serializer_test.rb +63 -0
  95. data/test/active_record_test.rb +1 -1
  96. data/test/adapter/fragment_cache_test.rb +3 -2
  97. data/test/adapter/json/belongs_to_test.rb +2 -2
  98. data/test/adapter/json/collection_test.rb +15 -5
  99. data/test/adapter/json/has_many_test.rb +3 -3
  100. data/test/adapter/json_api/belongs_to_test.rb +3 -3
  101. data/test/adapter/json_api/collection_test.rb +8 -6
  102. data/test/adapter/json_api/fields_test.rb +89 -0
  103. data/test/adapter/json_api/has_many_embed_ids_test.rb +2 -2
  104. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +2 -2
  105. data/test/adapter/json_api/has_many_test.rb +3 -3
  106. data/test/adapter/json_api/has_one_test.rb +2 -2
  107. data/test/adapter/json_api/json_api_test.rb +2 -2
  108. data/test/adapter/json_api/linked_test.rb +116 -5
  109. data/test/adapter/json_api/links_test.rb +68 -0
  110. data/test/adapter/json_api/pagination_links_test.rb +4 -4
  111. data/test/adapter/json_api/parse_test.rb +139 -0
  112. data/test/adapter/json_api/resource_type_config_test.rb +27 -15
  113. data/test/adapter/json_api/toplevel_jsonapi_test.rb +84 -0
  114. data/test/adapter/json_test.rb +2 -2
  115. data/test/adapter/null_test.rb +2 -2
  116. data/test/adapter_test.rb +3 -3
  117. data/test/array_serializer_test.rb +30 -93
  118. data/test/collection_serializer_test.rb +100 -0
  119. data/test/fixtures/poro.rb +19 -51
  120. data/test/generators/scaffold_controller_generator_test.rb +1 -0
  121. data/test/generators/serializer_generator_test.rb +2 -1
  122. data/test/grape_test.rb +82 -0
  123. data/test/include_tree/from_include_args_test.rb +26 -0
  124. data/test/include_tree/from_string_test.rb +94 -0
  125. data/test/include_tree/include_args_to_hash_test.rb +64 -0
  126. data/test/lint_test.rb +4 -1
  127. data/test/logger_test.rb +2 -2
  128. data/test/poro_test.rb +1 -1
  129. data/test/serializable_resource_test.rb +1 -1
  130. data/test/serializers/adapter_for_test.rb +24 -28
  131. data/test/serializers/association_macros_test.rb +1 -1
  132. data/test/serializers/associations_test.rb +143 -26
  133. data/test/serializers/attribute_test.rb +64 -3
  134. data/test/serializers/attributes_test.rb +1 -6
  135. data/test/serializers/cache_test.rb +46 -2
  136. data/test/serializers/configuration_test.rb +20 -3
  137. data/test/serializers/fieldset_test.rb +5 -16
  138. data/test/serializers/meta_test.rb +38 -29
  139. data/test/serializers/options_test.rb +1 -1
  140. data/test/serializers/root_test.rb +1 -1
  141. data/test/serializers/serializer_for_test.rb +78 -9
  142. data/test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  143. data/test/support/isolated_unit.rb +77 -0
  144. data/test/support/rails5_shims.rb +29 -0
  145. data/test/support/rails_app.rb +7 -3
  146. data/test/support/schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  147. data/test/support/schemas/active_model_serializers/test/schema_test/my/show.json +6 -0
  148. data/test/support/schemas/custom/show.json +7 -0
  149. data/test/support/schemas/hyper_schema.json +93 -0
  150. data/test/support/schemas/render_using_json_api.json +43 -0
  151. data/test/support/schemas/simple_json_pointers.json +10 -0
  152. data/test/support/serialization_testing.rb +46 -6
  153. data/test/support/test_case.rb +14 -0
  154. data/test/test_helper.rb +21 -14
  155. metadata +160 -16
  156. data/lib/active_model/serializer/adapter/flatten_json.rb +0 -12
  157. data/lib/active_model/serializer/railtie.rb +0 -15
  158. data/lib/active_model/serializer/utils.rb +0 -35
  159. data/lib/tasks/rubocop.rake +0 -0
  160. data/test/capture_warnings.rb +0 -65
  161. data/test/utils/include_args_to_hash_test.rb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f97fe4e6870c3e3338fb3415b762d451f07f2b9d
4
- data.tar.gz: a911ae55792f5fa60ddd9f198b21f3d9960d3647
3
+ metadata.gz: 3a84e967d6d485d49bae001e8937b44c77ea0100
4
+ data.tar.gz: 707f685e66fdd3e54ee76944d7594e272eaf2920
5
5
  SHA512:
6
- metadata.gz: 639b8b33bd971772668ead59b6e38b7f0e2aa5f36c4c680876a9241aeaa51b77e70efdfc5d8af84f9bd3bf9b5646848a8b1ad30c3e0927a98ca14fe9106410f7
7
- data.tar.gz: 9b61116bd804ea07f9294792e73d8736b3f06b5919739c304689bf0cf9d9ef7974467eb1fef4929a5ceb6ca9629d95067761428a6f8fa86cebb870bb4d1b3d05
6
+ metadata.gz: 090a01fff8f35b0e858f31a271f34c53f0d87bd82f1f5ead1e0515d38ee8447a0ba9d2f38abc0dfcf188efe59fdfc4d2057d28296dfe8a5e4abd6464c7dff635
7
+ data.tar.gz: 34095f697906ad34ca02913a5619a787d82382baf9b1a60cf9ed43fc74e9939aee8f1391c61dc4a16c60fcdcd009b1479bc407ed6b1c304c54f7081f01f67fc2
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  *.swp
22
22
  .ruby-version
23
23
  .ruby-gemset
24
+ vendor/bundle
@@ -8,39 +8,6 @@ AllCops:
8
8
  DisplayCopNames: true
9
9
  DisplayStyleGuide: true
10
10
 
11
- Style/IndentationConsistency:
12
- Exclude:
13
- - lib/active_model/serializer/adapter/flatten_json.rb
14
- - lib/active_model/serializer/adapter/fragment_cache.rb
15
- - lib/active_model/serializer/adapter/json.rb
16
- - lib/active_model/serializer/adapter/json/fragment_cache.rb
17
- - lib/active_model/serializer/adapter/json_api.rb
18
- - lib/active_model/serializer/adapter/json_api/fragment_cache.rb
19
- - lib/active_model/serializer/adapter/json_api/pagination_links.rb
20
- - lib/active_model/serializer/adapter/null.rb
21
-
22
- Style/IndentationWidth:
23
- Exclude:
24
- - lib/active_model/serializer/adapter/flatten_json.rb
25
- - lib/active_model/serializer/adapter/fragment_cache.rb
26
- - lib/active_model/serializer/adapter/json.rb
27
- - lib/active_model/serializer/adapter/json/fragment_cache.rb
28
- - lib/active_model/serializer/adapter/json_api.rb
29
- - lib/active_model/serializer/adapter/json_api/fragment_cache.rb
30
- - lib/active_model/serializer/adapter/json_api/pagination_links.rb
31
- - lib/active_model/serializer/adapter/null.rb
32
-
33
- Style/AccessModifierIndentation:
34
- Exclude:
35
- - lib/active_model/serializer/adapter/flatten_json.rb
36
- - lib/active_model/serializer/adapter/fragment_cache.rb
37
- - lib/active_model/serializer/adapter/json.rb
38
- - lib/active_model/serializer/adapter/json/fragment_cache.rb
39
- - lib/active_model/serializer/adapter/json_api.rb
40
- - lib/active_model/serializer/adapter/json_api/fragment_cache.rb
41
- - lib/active_model/serializer/adapter/json_api/pagination_links.rb
42
- - lib/active_model/serializer/adapter/null.rb
43
-
44
11
  Lint/NestedMethodDefinition:
45
12
  Enabled: false
46
13
  Exclude:
@@ -78,5 +45,42 @@ Style/ClassAndModuleChildren:
78
45
  Style/Documentation:
79
46
  Enabled: false
80
47
 
48
+ Style/MissingElse:
49
+ Enabled: true
50
+ EnforcedStyle: case
51
+
52
+ Style/EmptyElse:
53
+ EnforcedStyle: empty
54
+
81
55
  Style/MultilineOperationIndentation:
82
56
  EnforcedStyle: indented
57
+
58
+ Style/BlockDelimiters:
59
+ Enabled: true
60
+ EnforcedStyle: line_count_based
61
+
62
+ ########## test_helper.rb sanity
63
+ Style/EndBlock:
64
+ Exclude:
65
+ - test/test_helper.rb
66
+
67
+ Style/SpecialGlobalVars:
68
+ Exclude:
69
+ - test/test_helper.rb
70
+
71
+ Style/GlobalVars:
72
+ Exclude:
73
+ - test/test_helper.rb
74
+
75
+ Style/AndOr:
76
+ Exclude:
77
+ - test/test_helper.rb
78
+ - 'lib/active_model/serializer/lint.rb'
79
+
80
+ Style/Not:
81
+ Exclude:
82
+ - test/test_helper.rb
83
+
84
+ Style/ClassCheck:
85
+ Exclude:
86
+ - test/test_helper.rb
@@ -1,23 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-08-31 04:23:33 -0500 using RuboCop version 0.33.0.
3
+ # on 2015-09-20 17:56:22 -0500 using RuboCop version 0.34.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Configuration parameters: AllowSafeAssignment.
11
- Lint/AssignmentInCondition:
12
- Exclude:
13
- - 'lib/active_model/serializer/adapter/json_api.rb'
14
-
15
- # Offense count: 1
16
- Lint/EmptyEnsure:
17
- Exclude:
18
- - 'test/serializers/adapter_for_test.rb'
19
-
20
- # Offense count: 1
9
+ # Offense count: 2
21
10
  Lint/HandleExceptions:
22
11
  Exclude:
23
12
  - 'Rakefile'
@@ -28,27 +17,20 @@ Lint/UnusedBlockArgument:
28
17
  Exclude:
29
18
  - 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
30
19
 
31
- # Offense count: 9
20
+ # Offense count: 7
32
21
  # Cop supports --auto-correct.
33
22
  Lint/UnusedMethodArgument:
34
23
  Exclude:
35
- - 'lib/active_model/serializer/adapter.rb'
36
24
  - 'lib/active_model/serializer/adapter/null.rb'
37
25
  - 'lib/active_model/serializer/pass_through_serializer.rb'
38
26
  - 'test/fixtures/poro.rb'
39
27
  - 'test/lint_test.rb'
40
28
 
41
- # Offense count: 1
42
- Lint/UselessAccessModifier:
43
- Exclude:
44
- - 'lib/active_model/serializable_resource.rb'
45
-
46
- # Offense count: 3
29
+ # Offense count: 2
47
30
  Lint/UselessAssignment:
48
31
  Exclude:
49
32
  - 'bench/perf.rb'
50
33
  - 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
51
- - 'test/test_helper.rb'
52
34
 
53
35
  # Offense count: 1
54
36
  # Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -56,7 +38,7 @@ Rails/Date:
56
38
  Exclude:
57
39
  - 'test/fixtures/poro.rb'
58
40
 
59
- # Offense count: 8
41
+ # Offense count: 4
60
42
  # Configuration parameters: EnforcedStyle, SupportedStyles.
61
43
  Rails/TimeZone:
62
44
  Exclude:
@@ -71,41 +53,26 @@ Style/AlignHash:
71
53
  Exclude:
72
54
  - 'test/action_controller/json_api/pagination_test.rb'
73
55
 
74
- # Offense count: 1
75
- # Cop supports --auto-correct.
76
- # Configuration parameters: EnforcedStyle, SupportedStyles.
77
- Style/AndOr:
78
- Exclude:
79
- - 'lib/active_model/serializer/lint.rb'
80
-
81
- # Offense count: 6
82
- # Cop supports --auto-correct.
83
- # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
84
- Style/BlockDelimiters:
85
- Enabled: false
86
-
87
- # Offense count: 46
56
+ # Offense count: 25
88
57
  # Cop supports --auto-correct.
89
58
  # Configuration parameters: EnforcedStyle, SupportedStyles.
90
59
  Style/BracesAroundHashParameters:
91
60
  Exclude:
92
61
  - 'test/action_controller/adapter_selector_test.rb'
93
62
  - 'test/action_controller/json_api/pagination_test.rb'
94
- - 'test/action_controller/serialization_test.rb'
95
63
  - 'test/adapter/json_api/linked_test.rb'
96
64
  - 'test/adapter/json_api/pagination_links_test.rb'
97
65
  - 'test/adapter/null_test.rb'
98
66
  - 'test/adapter_test.rb'
99
- - 'test/array_serializer_test.rb'
67
+ - 'test/collection_serializer_test.rb'
100
68
  - 'test/serializable_resource_test.rb'
101
69
  - 'test/serializers/associations_test.rb'
102
70
  - 'test/serializers/attribute_test.rb'
103
71
  - 'test/serializers/attributes_test.rb'
104
72
  - 'test/serializers/fieldset_test.rb'
105
73
  - 'test/serializers/root_test.rb'
106
- - 'test/serializers/urls_test.rb'
107
74
 
108
- # Offense count: 167
75
+ # Offense count: 174
109
76
  # Configuration parameters: EnforcedStyle, SupportedStyles.
110
77
  Style/ClassAndModuleChildren:
111
78
  Enabled: false
@@ -126,13 +93,11 @@ Style/EachWithObject:
126
93
  Exclude:
127
94
  - 'lib/active_model/serializer/fieldset.rb'
128
95
 
129
- # Offense count: 3
96
+ # Offense count: 2
130
97
  # Configuration parameters: MinBodyLength.
131
98
  Style/GuardClause:
132
99
  Exclude:
133
100
  - 'lib/active_model/serializer.rb'
134
- - 'lib/active_model/serializer/adapter/json_api.rb'
135
- - 'test/capture_warnings.rb'
136
101
 
137
102
  # Offense count: 12
138
103
  # Cop supports --auto-correct.
@@ -155,34 +120,12 @@ Style/IndentArray:
155
120
  Style/IndentHash:
156
121
  Enabled: false
157
122
 
158
- # Offense count: 1
159
- # Cop supports --auto-correct.
160
- # Configuration parameters: EnforcedStyle, SupportedStyles.
161
- Style/IndentationConsistency:
162
- Exclude:
163
- - 'test/action_controller/serialization_scope_name_test.rb'
164
-
165
- # Offense count: 2
166
- # Cop supports --auto-correct.
167
- # Configuration parameters: Width.
168
- Style/IndentationWidth:
169
- Exclude:
170
- - 'lib/active_model/serializable_resource.rb'
171
- - 'lib/active_model/serializer/fieldset.rb'
172
-
173
123
  # Offense count: 1
174
124
  # Cop supports --auto-correct.
175
125
  Style/Lambda:
176
126
  Exclude:
177
127
  - 'lib/active_model/serializer.rb'
178
128
 
179
- # Offense count: 2
180
- # Cop supports --auto-correct.
181
- Style/MethodCallParentheses:
182
- Exclude:
183
- - 'lib/active_model/serializer/adapter/json.rb'
184
- - 'lib/active_model/serializer/adapter/json_api.rb'
185
-
186
129
  # Offense count: 1
187
130
  # Cop supports --auto-correct.
188
131
  # Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -201,24 +144,11 @@ Style/NegatedIf:
201
144
  Exclude:
202
145
  - 'lib/action_controller/serialization.rb'
203
146
 
204
- # Offense count: 1
205
- # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
206
- Style/Next:
207
- Exclude:
208
- - 'lib/active_model/serializer/adapter/json_api.rb'
209
-
210
147
  # Offense count: 1
211
148
  # Cop supports --auto-correct.
212
149
  Style/NumericLiterals:
213
150
  MinDigits: 7
214
151
 
215
- # Offense count: 2
216
- # Cop supports --auto-correct.
217
- # Configuration parameters: PreferredDelimiters.
218
- Style/PercentLiteralDelimiters:
219
- Exclude:
220
- - 'active_model_serializers.gemspec'
221
-
222
152
  # Offense count: 2
223
153
  # Cop supports --auto-correct.
224
154
  Style/PerlBackrefs:
@@ -226,20 +156,17 @@ Style/PerlBackrefs:
226
156
  - 'test/fixtures/poro.rb'
227
157
  - 'test/serializers/associations_test.rb'
228
158
 
229
- # Offense count: 6
159
+ # Offense count: 3
230
160
  # Configuration parameters: NamePrefix, NamePrefixBlacklist.
231
161
  Style/PredicateName:
232
162
  Exclude:
233
- - 'lib/active_model/serializer/adapter.rb'
234
- - 'lib/active_model/serializer/adapter/json_api.rb'
235
163
  - 'lib/active_model/serializer/associations.rb'
236
164
  - 'test/action_controller/json_api/linked_test.rb'
237
165
 
238
- # Offense count: 7
166
+ # Offense count: 5
239
167
  # Cop supports --auto-correct.
240
168
  Style/RedundantSelf:
241
169
  Exclude:
242
- - 'lib/active_model/serializer.rb'
243
170
  - 'lib/active_model/serializer/associations.rb'
244
171
  - 'test/fixtures/poro.rb'
245
172
 
@@ -250,13 +177,11 @@ Style/Semicolon:
250
177
  Exclude:
251
178
  - 'lib/active_model/serializer/fieldset.rb'
252
179
 
253
- # Offense count: 6
180
+ # Offense count: 3
254
181
  # Cop supports --auto-correct.
255
182
  # Configuration parameters: EnforcedStyle, SupportedStyles.
256
183
  Style/SignalException:
257
184
  Exclude:
258
- - 'lib/active_model/serializer.rb'
259
- - 'lib/active_model/serializer/adapter.rb'
260
185
  - 'lib/active_model/serializer/fieldset.rb'
261
186
  - 'lib/active_model/serializer/pass_through_serializer.rb'
262
187
 
@@ -299,7 +224,7 @@ Style/TrailingBlankLines:
299
224
  - 'test/serializers/fieldset_test.rb'
300
225
  - 'test/support/stream_capture.rb'
301
226
 
302
- # Offense count: 6
227
+ # Offense count: 5
303
228
  # Cop supports --auto-correct.
304
229
  # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
305
230
  Style/TrailingComma:
data/.simplecov CHANGED
@@ -41,6 +41,7 @@ SimpleCov.profiles.define 'app' do
41
41
  add_filter '/config/'
42
42
  add_filter '/db/'
43
43
  add_filter 'tasks'
44
+ add_filter '/.bundle/'
44
45
  end
45
46
 
46
47
  ## START TRACKING COVERAGE (before activating SimpleCov)
@@ -49,21 +50,32 @@ Coverage.start
49
50
 
50
51
  ## ADD SOME CUSTOM REPORTING AT EXIT
51
52
  SimpleCov.at_exit do
53
+ next if $! and not ($!.kind_of? SystemExit and $!.success?)
54
+
52
55
  header = "#{'*' * 20} SimpleCov Results #{'*' * 20}"
53
- @output.puts
54
- @output.puts header
55
- @output.puts SimpleCov.result.format!
56
+ results = SimpleCov.result.format!.join("\n")
57
+ exit_message = <<-EOF
58
+
59
+ #{header}
60
+ {{RESULTS}}
61
+ {{FAILURE_MESSAGE}}
62
+
63
+ #{'*' * header.size}
64
+ EOF
56
65
  percent = Float(SimpleCov.result.covered_percent)
57
66
  if percent < @minimum_coverage
58
- @output.puts "Spec coverage was not high enough: "\
59
- "#{percent.round(2)} is < #{@minimum_coverage}%\n"
60
- exit 1 if @generate_report
61
- else
62
- @output.puts "Nice job! Spec coverage (#{percent.round(2)}) "\
63
- "is still at or above #{@minimum_coverage}%\n"
67
+ failure_message = <<-EOF
68
+ Spec coverage was not high enough: #{percent.round(2)}% is < #{@minimum_coverage}%
69
+ EOF
70
+ exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', failure_message)
71
+ @output.puts exit_message
72
+ abort(failure_message) if @generate_report
73
+ elsif @running_ci
74
+ exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', <<-EOF)
75
+ Nice job! Spec coverage (#{percent.round(2)}%) is still at or above #{@minimum_coverage}%
76
+ EOF
77
+ @output.puts exit_message
64
78
  end
65
- @output.puts
66
- @output.puts '*' * header.size
67
79
  end
68
80
 
69
81
  ## CAPTURE CONFIG IN CLOSURE 'AppCoverage.start'
@@ -2,24 +2,21 @@ language: ruby
2
2
 
3
3
  sudo: false
4
4
 
5
- cache:
6
- bundler: true
7
-
8
5
  rvm:
9
- - 1.9.3
10
6
  - 2.0.0
11
7
  - 2.1
12
- - 2.2
13
- - jruby-19mode
14
- - rbx-2
8
+ - 2.2.3
9
+ - 2.3.0
15
10
  - ruby-head
11
+ - rbx-2
16
12
 
17
- install:
18
- - bundle install --retry=3
13
+ install: bundle install --path=vendor/bundle --retry=3 --jobs=3
14
+ cache:
15
+ directories:
16
+ - vendor/bundle
19
17
 
20
18
  script:
21
- - bundle exec rake
22
- - bundle exec rake rubocop
19
+ - bundle exec rake ci
23
20
 
24
21
  env:
25
22
  - "RAILS_VERSION=4.0"
@@ -28,7 +25,15 @@ env:
28
25
  - "RAILS_VERSION=master"
29
26
 
30
27
  matrix:
28
+ exclude:
29
+ - rvm: 2.0.0
30
+ env: RAILS_VERSION=master
31
+ - rvm: 2.1
32
+ env: RAILS_VERSION=master
33
+ include:
34
+ - rvm: jruby-9.0.4.0
35
+ env: JRUBY_OPTS='-Xcompat.version=2.0 --server -Xcompile.invokedynamic=false -Xcli.debug=true --debug'
31
36
  allow_failures:
32
37
  - rvm: ruby-head
33
- - env: "RAILS_VERSION=master"
38
+ - rvm: rbx-2
34
39
  fast_finish: true
@@ -1,14 +1,419 @@
1
- ### 0.10.0
1
+ ## 0.10.x
2
2
 
3
+
4
+ ### v0.10.0.rc4 (2016/01/27 11:00 +00:00)
5
+ Breaking changes:
6
+
7
+ - [#1360](https://github.com/rails-api/active_model_serializers/pull/1360)
8
+ [#1369](https://github.com/rails-api/active_model_serializers/pull/1369) Drop support for Ruby 1.9.3 (@karaAJC, @maurogeorge)
9
+ - [#1131](https://github.com/rails-api/active_model_serializers/pull/1131) Remove Serializer#root_name (@beauby)
10
+ - [#1138](https://github.com/rails-api/active_model_serializers/pull/1138) Introduce Adapter::Base (@bf4)
11
+ * Adapters now inherit Adapter::Base. 'Adapter' is now a module, no longer a class.
12
+ * using a class as a namespace that you also inherit from is complicated and circular at times i.e.
13
+ buggy (see https://github.com/rails-api/active_model_serializers/pull/1177)
14
+ * The class methods on Adapter aren't necessarily related to the instance methods, they're more
15
+ Adapter functions.
16
+ * named `Base` because it's a Rails-ism.
17
+ * It helps to isolate and highlight what the Adapter interface actually is.
18
+ - [#1418](https://github.com/rails-api/active_model_serializers/pull/1418)
19
+ serialized collections now use the root option as is; now, only the
20
+ root derived from the serializer or object is always pluralized.
21
+
22
+ Features:
23
+
24
+ - [#1406](https://github.com/rails-api/active_model_serializers/pull/1406) Allow for custom dynamic values in JSON API links (@beauby)
25
+ - [#1270](https://github.com/rails-api/active_model_serializers/pull/1270) Adds `assert_response_schema` test helper (@maurogeorge)
26
+ - [#1099](https://github.com/rails-api/active_model_serializers/pull/1099) Adds `assert_serializer` test helper (@maurogeorge)
27
+ - [#1403](https://github.com/rails-api/active_model_serializers/pull/1403) Add support for if/unless on attributes/associations (@beauby)
28
+ - [#1248](https://github.com/rails-api/active_model_serializers/pull/1248) Experimental: Add support for JSON API deserialization (@beauby)
29
+ - [#1378](https://github.com/rails-api/active_model_serializers/pull/1378) Change association blocks
30
+ to be evaluated in *serializer* scope, rather than *association* scope. (@bf4)
31
+ * Syntax changes from e.g.
32
+ `has_many :titles do customers.pluck(:title) end` (in #1356) to
33
+ `has_many :titles do object.customers.pluck(:title) end`
34
+ - [#1356](https://github.com/rails-api/active_model_serializers/pull/1356) Add inline syntax for
35
+ attributes and associations (@bf4 @beauby @noahsilas)
36
+ * Allows defining attributes so that they don't conflict with existing methods. e.g. `attribute
37
+ :title do 'Mr. Topum Hat' end`
38
+ * Allows defining associations so that they don't conflict with existing methods. e.g. `has_many
39
+ :titles do customers.pluck(:title) end`
40
+ * Allows dynamic associations, as compared to compare to using
41
+ [`virtual_value`](https://github.com/rails-api/active_model_serializers/pull/1356#discussion_r47146466).
42
+ e.g. `has_many :reviews, virtual_value: [{ id: 1 }, { id: 2 }]`
43
+ * Removes dynamically defined methods on the serializer
44
+ - [#1336](https://github.com/rails-api/active_model_serializers/pull/1336) Added support for Grape >= 0.13, < 1.0 (@johnhamelink)
45
+ - [#1322](https://github.com/rails-api/active_model_serializers/pull/1322) Instrumenting rendering of resources (@bf4, @maurogeorge)
46
+ - [#1291](https://github.com/rails-api/active_model_serializers/pull/1291) Add logging (@maurogeorge)
47
+ - [#1272](https://github.com/rails-api/active_model_serializers/pull/1272) Add PORO serializable base class: ActiveModelSerializers::Model (@bf4)
48
+ - [#1255](https://github.com/rails-api/active_model_serializers/pull/1255) Make more class attributes inheritable (@bf4)
49
+ - [#1249](https://github.com/rails-api/active_model_serializers/pull/1249) Inheritance of serializer inheriting the cache configuration(@Rodrigora)
50
+ - [#1247](https://github.com/rails-api/active_model_serializers/pull/1247) Add support for toplevel JSON API links (@beauby)
51
+ - [#1246](https://github.com/rails-api/active_model_serializers/pull/1246) Add support for resource-level JSON API links (@beauby)
52
+ - [#1225](https://github.com/rails-api/active_model_serializers/pull/1225) Better serializer lookup, use nested serializer when it exists (@beauby)
53
+ - [#1213](https://github.com/rails-api/active_model_serializers/pull/1213) `type` directive for serializer to control type field with json-api adapter (@youroff)
54
+ - [#1172](https://github.com/rails-api/active_model_serializers/pull/1172) Better serializer registration, get more than just the first module (@bf4)
55
+ - [#1158](https://github.com/rails-api/active_model_serializers/pull/1158) Add support for wildcards in `include` option (@beauby)
56
+ - [#1127](https://github.com/rails-api/active_model_serializers/pull/1127) Add support for nested
57
+ associations for JSON and Attributes adapters via the `include` option (@NullVoxPopuli, @beauby).
58
+ - [#1050](https://github.com/rails-api/active_model_serializers/pull/1050) Add support for toplevel jsonapi member (@beauby, @bf4)
59
+ - [#1251](https://github.com/rails-api/active_model_serializers/pull/1251) Rename ArraySerializer to
60
+ CollectionSerializer for clarity, add ActiveModelSerializers.config.collection_serializer (@bf4)
61
+ - [#1295](https://github.com/rails-api/active_model_serializers/pull/1295) Add config `serializer_lookup_enabled` that,
62
+ when disabled, requires serializers to explicitly specified. (@trek)
63
+
64
+ Fixes:
65
+
66
+ - [#1352](https://github.com/rails-api/active_model_serializers/pull/1352) Fix generators; Isolate Rails-specifc code in Railties (@dgynn, @bf4)
67
+ - [#1384](https://github.com/rails-api/active_model_serializers/pull/1384)Fix database state leaking across tests (@bf4)
68
+ - [#1297](https://github.com/rails-api/active_model_serializers/pull/1297) Fix `fields` option to restrict relationships as well (@beauby)
69
+ - [#1239](https://github.com/rails-api/active_model_serializers/pull/1239) Fix duplicates in JSON API compound documents (@beauby)
70
+ - [#1214](https://github.com/rails-api/active_model_serializers/pull/1214) retrieve the key from the reflection options when building associations (@NullVoxPopuli, @hut8)
71
+ - [#1358](https://github.com/rails-api/active_model_serializers/pull/1358) Handle serializer file paths with spaces (@rwstauner, @bf4)
72
+ - [#1195](https://github.com/rails-api/active_model_serializers/pull/1195) Fix id override (@beauby)
73
+ - [#1185](https://github.com/rails-api/active_model_serializers/pull/1185) Fix options passing in Json and Attributes adapters (@beauby)
74
+
75
+ Misc:
76
+
77
+ - [#1383](https://github.com/rails-api/active_model_serializers/pull/1383) Simplify reflections handling (@beauby)
78
+ - [#1370](https://github.com/rails-api/active_model_serializers/pull/1370) Simplify attributes handling via a mixin (@beauby)
79
+ - [#1301](https://github.com/rails-api/active_model_serializers/pull/1301) Mapping JSON API spec / schema to AMS (@bf4)
80
+ - [#1271](https://github.com/rails-api/active_model_serializers/pull/1271) Handle no serializer source file to digest (@bf4)
81
+ - [#1260](https://github.com/rails-api/active_model_serializers/pull/1260) Serialization and Cache Documentation (@bf4)
82
+ - [#1259](https://github.com/rails-api/active_model_serializers/pull/1259) Add more info to CONTRIBUTING (@bf4)
83
+ - [#1233](https://github.com/rails-api/active_model_serializers/pull/1233) Top-level meta and meta_key options no longer handled at serializer level (@beauby)
84
+ - [#1232](https://github.com/rails-api/active_model_serializers/pull/1232) fields option no longer handled at serializer level (@beauby)
85
+ - [#1220](https://github.com/rails-api/active_model_serializers/pull/1220) Remove empty rubocop.rake (@maurogeorge)
86
+ - [#1178](https://github.com/rails-api/active_model_serializers/pull/1178) env CAPTURE_STDERR=false lets devs see hard failures (@bf4)
87
+ - [#1177](https://github.com/rails-api/active_model_serializers/pull/1177) Remove Adapter autoloads in favor of require (@bf4)
88
+ - [#1117](https://github.com/rails-api/active_model_serializers/pull/1117) FlattenJson adapter no longer inherits Json adapter, renamed to Attributes (@bf4)
89
+ - [#1171](https://github.com/rails-api/active_model_serializers/pull/1171) add require statements to top of file (@shicholas)
90
+ - [#1167](https://github.com/rails-api/active_model_serializers/pull/1167) Delegate Serializer.attributes to Serializer.attribute (@bf4)
91
+ - [#1174](https://github.com/rails-api/active_model_serializers/pull/1174) Consistently refer to the 'JSON API' and the 'JsonApi' adapter (@bf4)
92
+ - [#1173](https://github.com/rails-api/active_model_serializers/pull/1173) Comment private accessor warnings (@bf4)
93
+ - [#1166](https://github.com/rails-api/active_model_serializers/pull/1166) Prefer methods over instance variables (@bf4)
94
+ - [#1168](https://github.com/rails-api/active_model_serializers/pull/1168) Fix appveyor failure cache not being expired (@bf4)
95
+ - [#1161](https://github.com/rails-api/active_model_serializers/pull/1161) Remove duplicate test helper (@bf4)
96
+ - [#1360](https://github.com/rails-api/active_model_serializers/pull/1360) Update CI to test 2.2.2 -> 2.2.3 (@karaAJC)
97
+ - [#1371](https://github.com/rails-api/active_model_serializers/pull/1371) Refactor, update, create documentation (@bf4)
98
+
99
+ ### v0.10.0.rc3 (2015/09/16 15:19 +00:00)
100
+ - [#1129](https://github.com/rails-api/active_model_serializers/pull/1129) Remove SerializableResource.serialize in favor of `.new` (@bf4)
101
+ - [#1155](https://github.com/rails-api/active_model_serializers/pull/1155) Outside controller use tutorial (@CodedBeardedSignedTaylor)
102
+ - [#1154](https://github.com/rails-api/active_model_serializers/pull/1154) Rubocop fixes for issues introduced by #1089 (@NullVoxPopuli)
103
+ - [#1089](https://github.com/rails-api/active_model_serializers/pull/1089) Add ActiveModelSerializers.logger with default null device (@bf4)
104
+ - [#1109](https://github.com/rails-api/active_model_serializers/pull/1109) Make better use of Minitest's lifecycle (@bf4)
105
+ - [#1144](https://github.com/rails-api/active_model_serializers/pull/1144) Fix Markdown to adapters documentation (@bacarini)
106
+ - [#1121](https://github.com/rails-api/active_model_serializers/pull/1121) Refactor `add_links` in JSONAPI adapter. (@beauby)
107
+ - [#1150](https://github.com/rails-api/active_model_serializers/pull/1150) Remove legacy method accidentally reintroduced in #1017 (@beauby)
108
+ - [#1149](https://github.com/rails-api/active_model_serializers/pull/1149) Update README with nested included association example. (@mattmueller)
109
+ - [#1110](https://github.com/rails-api/active_model_serializers/pull/1110) Add lint tests for AR models (@beauby)
110
+ - [#1131](https://github.com/rails-api/active_model_serializers/pull/1131) Extended format for JSONAPI `include` option (@beauby)
111
+ * adds extended format for `include` option to JsonApi adapter
112
+ - [#1142](https://github.com/rails-api/active_model_serializers/pull/1142) Updating wording on cache expiry in README (@leighhalliday)
113
+ - [#1140](https://github.com/rails-api/active_model_serializers/pull/1140) Fix typo in fieldset exception (@lautis)
114
+ - [#1132](https://github.com/rails-api/active_model_serializers/pull/1132) Get rid of unnecessary instance variables, and implied dependencies. (@beauby)
115
+ - [#1139](https://github.com/rails-api/active_model_serializers/pull/1139) Documentation for serializing resources without render (@PericlesTheo)
116
+ - [#1017](https://github.com/rails-api/active_model_serializers/pull/1017) Make Adapters registerable so they are not namespace-constrained (@bf4)
117
+ - [#1120](https://github.com/rails-api/active_model_serializers/pull/1120) Add windows platform to loading sqlite3 (@Eric-Guo)
118
+ - [#1123](https://github.com/rails-api/active_model_serializers/pull/1123) Remove url options (@bacarini)
119
+ - [#1093](https://github.com/rails-api/active_model_serializers/pull/1093) Factor `with_adapter` + force cache clear before each test. (@beauby)
120
+ - [#1095](https://github.com/rails-api/active_model_serializers/pull/1095) Add documentation about configuration options. (@beauby)
121
+ - [#1069](https://github.com/rails-api/active_model_serializers/pull/1069) Add test coverage; account for no artifacts on CI (@bf4)
122
+ - [#1103](https://github.com/rails-api/active_model_serializers/pull/1103) Move `id` and `json_api_type` methods from `Serializer` to `JsonApi`. (@beauby)
123
+ - [#1106](https://github.com/rails-api/active_model_serializers/pull/1106) Add Style enforcer (via Rubocop) (@bf4)
124
+ - [#1079](https://github.com/rails-api/active_model_serializers/pull/1079) Add ArraySerializer#object like Serializer (@bf4)
125
+ - [#1096](https://github.com/rails-api/active_model_serializers/pull/1096) Fix definition of serializer attributes with multiple calls to `attri… (@beauby)
126
+ - [#1105](https://github.com/rails-api/active_model_serializers/pull/1105) Add ActiveRecord-backed fixtures. (@beauby)
127
+ - [#1108](https://github.com/rails-api/active_model_serializers/pull/1108) Better lint (@bf4)
128
+ - [#1102](https://github.com/rails-api/active_model_serializers/pull/1102) Remove remains of `embed` option. (@beauby)
129
+ - [#1090](https://github.com/rails-api/active_model_serializers/pull/1090) Clarify AMS dependencies (@bf4)
130
+ - [#1081](https://github.com/rails-api/active_model_serializers/pull/1081) Add configuration option to set resource type to singular/plural (@beauby)
131
+ - [#1067](https://github.com/rails-api/active_model_serializers/pull/1067) Fix warnings (@bf4)
132
+ - [#1066](https://github.com/rails-api/active_model_serializers/pull/1066) Adding appveyor to the project (@joaomdmoura, @Eric-Guo, @bf4)
133
+ - [#1071](https://github.com/rails-api/active_model_serializers/pull/1071) Make testing suite running and pass in Windows (@Eric-Guo, @bf4)
134
+ - [#1041](https://github.com/rails-api/active_model_serializers/pull/1041) Adding pagination links (@bacarini)
135
+ * adds support for `pagination links` at top level of JsonApi adapter
136
+ - [#1063](https://github.com/rails-api/active_model_serializers/pull/1063) Lead by example: lint PORO model (@bf4)
137
+ - [#1](https://github.com/rails-api/active_model_serializers/pull/1) Test caller line parsing and digesting (@bf4)
138
+ - [#1048](https://github.com/rails-api/active_model_serializers/pull/1048) Let FlattenJson adapter decide it doesn't include meta (@bf4)
139
+ - [#1060](https://github.com/rails-api/active_model_serializers/pull/1060) Update fragment cache to support namespaced objects (@aaronlerch)
140
+ - [#1052](https://github.com/rails-api/active_model_serializers/pull/1052) Use underscored json_root when serializing a collection (@whatthewhat)
141
+ - [#1051](https://github.com/rails-api/active_model_serializers/pull/1051) Fix some invalid JSON in docs (@tjschuck)
142
+ - [#1049](https://github.com/rails-api/active_model_serializers/pull/1049) Fix incorrect s/options = {}/options ||= {} (@bf4)
143
+ - [#1037](https://github.com/rails-api/active_model_serializers/pull/1037) allow for type attribute (@lanej)
144
+ - [#1034](https://github.com/rails-api/active_model_serializers/pull/1034) allow id attribute to be overriden (@lanej)
145
+ - [#1035](https://github.com/rails-api/active_model_serializers/pull/1035) Fixed Comments highlight (@artLopez)
146
+ - [#1031](https://github.com/rails-api/active_model_serializers/pull/1031) Disallow to define multiple associations at once (@bolshakov)
147
+ - [#1032](https://github.com/rails-api/active_model_serializers/pull/1032) Wrap railtie requirement with rescue (@elliotlarson)
148
+ - [#1026](https://github.com/rails-api/active_model_serializers/pull/1026) Bump Version Number to 0.10.0.rc2 (@jfelchner)
149
+ - [#985](https://github.com/rails-api/active_model_serializers/pull/985) Associations implementation refactoring (@bolshakov)
150
+ - [#954](https://github.com/rails-api/active_model_serializers/pull/954) Encapsulate serialization in ActiveModel::SerializableResource (@bf4)
151
+ - [#972](https://github.com/rails-api/active_model_serializers/pull/972) Capture app warnings on test run (@bf4)
152
+ - [#1019](https://github.com/rails-api/active_model_serializers/pull/1019) Improve README.md (@baojjeu)
153
+ - [#998](https://github.com/rails-api/active_model_serializers/pull/998) Changing root to model class name (@joaomdmoura)
154
+ - [#1006](https://github.com/rails-api/active_model_serializers/pull/1006) Fix adapter inflection bug for api -> API (@bf4)
155
+ - [#1016](https://github.com/rails-api/active_model_serializers/pull/1016) require rails/railtie before subclassing Rails::Railtie (@bf4)
156
+ - [#1013](https://github.com/rails-api/active_model_serializers/pull/1013) Root option with empty array support (@vyrak, @mareczek)
157
+ - [#994](https://github.com/rails-api/active_model_serializers/pull/994) Starting Docs structure (@joaomdmoura)
158
+ - [#1007](https://github.com/rails-api/active_model_serializers/pull/1007) Bug fix for ArraySerializer json_key (@jiajiawang)
159
+ - [#1003](https://github.com/rails-api/active_model_serializers/pull/1003) Fix transient test failures (@Rodrigora)
160
+ - [#996](https://github.com/rails-api/active_model_serializers/pull/996) Add linter for serializable resource (@bf4)
161
+ - [#990](https://github.com/rails-api/active_model_serializers/pull/990) Adding json-api meta test (@joaomdmoura)
162
+ - [#984](https://github.com/rails-api/active_model_serializers/pull/984) Add option "key" to serializer associations (@Rodrigora)
163
+ - [#982](https://github.com/rails-api/active_model_serializers/pull/982) Fix typo (@bf4)
164
+ - [#981](https://github.com/rails-api/active_model_serializers/pull/981) Remove unused PORO#to_param (@bf4)
165
+ - [#978](https://github.com/rails-api/active_model_serializers/pull/978) fix generators template bug (@regonn)
166
+ - [#975](https://github.com/rails-api/active_model_serializers/pull/975) Fixes virtual value not being used (@GriffinHeart)
167
+ - [#970](https://github.com/rails-api/active_model_serializers/pull/970) Fix transient tests failures (@Rodrigora)
168
+ - [#962](https://github.com/rails-api/active_model_serializers/pull/962) Rendering objects that doesn't have serializers (@bf4, @joaomdmoura, @JustinAiken)
169
+ - [#939](https://github.com/rails-api/active_model_serializers/pull/939) Use a more precise generated cache key (@aaronlerch)
170
+ - [#971](https://github.com/rails-api/active_model_serializers/pull/971) Restore has_one to generator (@bf4)
171
+ - [#965](https://github.com/rails-api/active_model_serializers/pull/965) options fedault valueserializable_hash and as_json (@bf4)
172
+ - [#959](https://github.com/rails-api/active_model_serializers/pull/959) TYPO on README.md (@kangkyu)
173
+
174
+ ### v0.10.0.rc2 (2015/06/16 21:30 +00:00)
175
+ - [#958](https://github.com/rails-api/active_model_serializers/pull/958) Splitting json adapter into two (@joaomdmoura)
176
+ * adds FlattenJSON as default adapter
177
+ - [#953](https://github.com/rails-api/active_model_serializers/pull/953) use model name to determine the type (@lsylvester)
178
+ * uses model name to determine the type
179
+ - [#949](https://github.com/rails-api/active_model_serializers/pull/949) Don't pass serializer option to associated serializers (@bf4, @edwardloveall)
180
+ - [#902](https://github.com/rails-api/active_model_serializers/pull/902) Added serializer file digest to the cache_key (@cristianbica)
181
+ - [#948](https://github.com/rails-api/active_model_serializers/pull/948) AMS supports JSONAPI 1.0 instead of RC4 (@SeyZ)
182
+ - [#936](https://github.com/rails-api/active_model_serializers/pull/936) Include meta when using json adapter with custom root (@chrisbranson)
183
+ - [#942](https://github.com/rails-api/active_model_serializers/pull/942) Small code styling issue (@thiagofm)
184
+ - [#930](https://github.com/rails-api/active_model_serializers/pull/930) Reverting PR #909 (@joaomdmoura)
185
+ - [#924](https://github.com/rails-api/active_model_serializers/pull/924) Avoid unecessary calls to attribute methods when fragment caching (@navinpeiris)
186
+ - [#925](https://github.com/rails-api/active_model_serializers/pull/925) Updates JSON API Adapter to generate RC4 schema (@benedikt)
187
+ * adds JSON API support 1.0
188
+ - [#918](https://github.com/rails-api/active_model_serializers/pull/918) Adding rescue_with_handler to clear state (@ryansch)
189
+ - [#909](https://github.com/rails-api/active_model_serializers/pull/909) Defining Json-API Adapter as Default (@joaomdmoura)
190
+ * remove root key option and split JSON adapter
191
+ - [#914](https://github.com/rails-api/active_model_serializers/pull/914) Prevent possible duplicated attributes in serializer (@groyoh)
192
+ - [#880](https://github.com/rails-api/active_model_serializers/pull/880) Inabling subclasses serializers to inherit attributes (@groyoh)
193
+ - [#913](https://github.com/rails-api/active_model_serializers/pull/913) Avoiding the serializer option when instantiating a new one for ArraySerializer Fixed #911 (@groyoh)
194
+ - [#897](https://github.com/rails-api/active_model_serializers/pull/897) Allow to define custom serializer for given class (@imanel)
195
+ - [#892](https://github.com/rails-api/active_model_serializers/pull/892) Fixed a bug that appeared when json adapter serialize a nil association (@groyoh)
196
+ - [#895](https://github.com/rails-api/active_model_serializers/pull/895) Adding a test to cover 'meta' and 'meta_key' attr_readers (@adomokos)
197
+ - [#894](https://github.com/rails-api/active_model_serializers/pull/894) Fixing typos in README.md (@adomokos)
198
+ - [#888](https://github.com/rails-api/active_model_serializers/pull/888) Changed duplicated test name in action controller test (@groyoh)
199
+ - [#890](https://github.com/rails-api/active_model_serializers/pull/890) Remove unused method `def_serializer` (@JustinAiken)
200
+ - [#887](https://github.com/rails-api/active_model_serializers/pull/887) Fixing tests on JRuby (@joaomdmoura)
201
+ - [#885](https://github.com/rails-api/active_model_serializers/pull/885) Updates rails versions for test and dev (@tonyta)
202
+
203
+ ### v0.10.0.rc1 (2015/04/22 06:06 +00:00)
204
+ - [#810](https://github.com/rails-api/active_model_serializers/pull/810) Adding Fragment Cache to AMS (@joaomdmoura)
205
+ * adds fragment cache support
206
+ - [#868](https://github.com/rails-api/active_model_serializers/pull/868) Fixed a bug that appears when a nil association is included (@groyoh)
207
+ - [#861](https://github.com/rails-api/active_model_serializers/pull/861) README: Add emphasis to single-word difference (@machty)
208
+ - [#858](https://github.com/rails-api/active_model_serializers/pull/858) Included resource fixes (@mateomurphy)
209
+ - [#853](https://github.com/rails-api/active_model_serializers/pull/853) RC3 Updates for JSON API (@mateomurphy)
210
+ - [#852](https://github.com/rails-api/active_model_serializers/pull/852) Fix options merge order in `each_association` (@mateomurphy)
211
+ - [#850](https://github.com/rails-api/active_model_serializers/pull/850) Use association value for determining serializer used (@mateomurphy)
212
+ - [#843](https://github.com/rails-api/active_model_serializers/pull/843) Remove the mailing list from the README (@JoshSmith)
213
+ - [#842](https://github.com/rails-api/active_model_serializers/pull/842) Add notes on how you can help to contributing documentation (@JoshSmith)
214
+ - [#833](https://github.com/rails-api/active_model_serializers/pull/833) Cache serializers for class (@lsylvester)
215
+ - [#837](https://github.com/rails-api/active_model_serializers/pull/837) Store options in array serializers (@kurko)
216
+ - [#836](https://github.com/rails-api/active_model_serializers/pull/836) Makes passed in options accessible inside serializers (@kurko)
217
+ - [#773](https://github.com/rails-api/active_model_serializers/pull/773) Make json api adapter 'include' option accept an array (@sweatypitts)
218
+ - [#830](https://github.com/rails-api/active_model_serializers/pull/830) Add contributing readme (@JoshSmith)
219
+ - [#811](https://github.com/rails-api/active_model_serializers/pull/811) Reimplement serialization scope and scope_name (@mateomurphy)
220
+ - [#725](https://github.com/rails-api/active_model_serializers/pull/725) Support has_one to be compatible with 0.8.x (@ggordon)
221
+ * adds `has_one` attribute for backwards compatibility
222
+ - [#822](https://github.com/rails-api/active_model_serializers/pull/822) Replace has_one with attribute in template (@bf4)
223
+ - [#821](https://github.com/rails-api/active_model_serializers/pull/821) Fix explicit serializer for associations (@wjordan)
224
+ - [#798](https://github.com/rails-api/active_model_serializers/pull/798) Fix lost test `test_include_multiple_posts_and_linked` (@donbobka)
225
+ - [#807](https://github.com/rails-api/active_model_serializers/pull/807) Add Overriding attribute methods section to README. (@alexstophel)
226
+ - [#693](https://github.com/rails-api/active_model_serializers/pull/693) Cache Support at AMS 0.10.0 (@joaomdmoura)
227
+ * adds cache support to attributes and associations.
228
+ - [#792](https://github.com/rails-api/active_model_serializers/pull/792) Association overrides (@kurko)
229
+ * adds method to override association
230
+ - [#794](https://github.com/rails-api/active_model_serializers/pull/794) add to_param for correct URL generation (@carlesjove)
231
+
232
+ ### v0.10.0-pre
233
+
234
+ - [Introduce Adapter](https://github.com/rails-api/active_model_serializers/commit/f00fe5595ddf741dc26127ed8fe81adad833ead5)
235
+ - Prefer `ActiveModel::Serializer` to `ActiveModelSerializers`:
236
+ - [Namespace](https://github.com/rails-api/active_model_serializers/commit/729a823868e8c7ac86c653fcc7100ee511e08cb6#diff-fe7aa2941c19a41ccea6e52940d84016).
237
+ - [README](https://github.com/rails-api/active_model_serializers/commit/4a2d9853ba7486acc1747752982aa5650e7fd6e9).
238
+
239
+ ## 0.09.x
240
+
241
+ ### v0.9.3 (2015/01/21 20:29 +00:00)
242
+
243
+ Features:
244
+ - [#774](https://github.com/rails-api/active_model_serializers/pull/774) Fix nested include attributes (@nhocki)
245
+ - [#771](https://github.com/rails-api/active_model_serializers/pull/771) Make linked resource type names consistent with root names (@sweatypitts)
246
+ - [#696](https://github.com/rails-api/active_model_serializers/pull/696) Explicitly set serializer for associations (@ggordon)
247
+ - [#700](https://github.com/rails-api/active_model_serializers/pull/700) sparse fieldsets (@arenoir)
248
+ - [#768](https://github.com/rails-api/active_model_serializers/pull/768) Adds support for `meta` and `meta_key` attribute (@kurko)
249
+
250
+ ### v0.9.1 (2014/12/04 11:54 +00:00)
251
+ - [#707](https://github.com/rails-api/active_model_serializers/pull/707) A Friendly Note on Which AMS Version to Use (@jherdman)
252
+ - [#730](https://github.com/rails-api/active_model_serializers/pull/730) Fixes nested has_many links in JSONAPI (@kurko)
253
+ - [#718](https://github.com/rails-api/active_model_serializers/pull/718) Allow overriding the adapter with render option (@ggordon)
254
+ - [#720](https://github.com/rails-api/active_model_serializers/pull/720) Rename attribute with :key (0.8.x compatibility) (@ggordon)
255
+ - [#728](https://github.com/rails-api/active_model_serializers/pull/728) Use type as key for linked resources (@kurko)
256
+ - [#729](https://github.com/rails-api/active_model_serializers/pull/729) Use the new beta build env on Travis (@joshk)
257
+ - [#703](https://github.com/rails-api/active_model_serializers/pull/703) Support serializer and each_serializer options in renderer (@ggordon, @mieko)
258
+ - [#727](https://github.com/rails-api/active_model_serializers/pull/727) Includes links inside of linked resources (@kurko)
259
+ - [#726](https://github.com/rails-api/active_model_serializers/pull/726) Bugfix: include nested has_many associations (@kurko)
260
+ - [#722](https://github.com/rails-api/active_model_serializers/pull/722) Fix infinite recursion (@ggordon)
261
+ - [#1](https://github.com/rails-api/active_model_serializers/pull/1) Allow for the implicit use of ArraySerializer when :each_serializer is specified (@mieko)
262
+ - [#692](https://github.com/rails-api/active_model_serializers/pull/692) Include 'linked' member for json-api collections (@ggordon)
263
+ - [#714](https://github.com/rails-api/active_model_serializers/pull/714) Define as_json instead of to_json (@guilleiguaran)
264
+ - [#710](https://github.com/rails-api/active_model_serializers/pull/710) JSON-API: Don't include linked section if associations are empty (@guilleiguaran)
265
+ - [#711](https://github.com/rails-api/active_model_serializers/pull/711) Fixes rbx gems bundling on TravisCI (@kurko)
266
+ - [#709](https://github.com/rails-api/active_model_serializers/pull/709) Add type key when association name is different than object type (@guilleiguaran)
267
+ - [#708](https://github.com/rails-api/active_model_serializers/pull/708) Handle correctly null associations (@guilleiguaran)
268
+ - [#691](https://github.com/rails-api/active_model_serializers/pull/691) Fix embed option for associations (@jacob-s-son)
269
+ - [#689](https://github.com/rails-api/active_model_serializers/pull/689) Fix support for custom root in JSON-API adapter (@guilleiguaran)
270
+ - [#685](https://github.com/rails-api/active_model_serializers/pull/685) Serialize ids as strings in JSON-API adapter (@guilleiguaran)
271
+ - [#684](https://github.com/rails-api/active_model_serializers/pull/684) Refactor adapters to implement support for array serialization (@guilleiguaran)
272
+ - [#682](https://github.com/rails-api/active_model_serializers/pull/682) Include root by default in JSON-API serializers (@guilleiguaran)
273
+ - [#625](https://github.com/rails-api/active_model_serializers/pull/625) Add DSL for urls (@JordanFaust)
274
+ - [#677](https://github.com/rails-api/active_model_serializers/pull/677) Add support for embed: :ids option for in associations (@guilleiguaran)
275
+ - [#681](https://github.com/rails-api/active_model_serializers/pull/681) Check superclasses for Serializers (@quainjn)
276
+ - [#680](https://github.com/rails-api/active_model_serializers/pull/680) Add support for root keys (@NullVoxPopuli)
277
+ - [#675](https://github.com/rails-api/active_model_serializers/pull/675) Support Rails 4.2.0 (@tricknotes)
278
+ - [#667](https://github.com/rails-api/active_model_serializers/pull/667) Require only activemodel instead of full rails (@guilleiguaran)
279
+ - [#653](https://github.com/rails-api/active_model_serializers/pull/653) Add "_test" suffix to JsonApi::HasManyTest filename. (@alexgenco)
280
+ - [#631](https://github.com/rails-api/active_model_serializers/pull/631) Update build badge URL (@craiglittle)
281
+
282
+ ### 0.9.0.alpha1 - January 7, 2014
283
+
284
+ ### 0.9.0.pre
285
+
286
+ * The following methods were removed
287
+ - Model#active\_model\_serializer
288
+ - Serializer#include!
289
+ - Serializer#include?
290
+ - Serializer#attr\_disabled=
291
+ - Serializer#cache
292
+ - Serializer#perform\_caching
293
+ - Serializer#schema (needs more discussion)
294
+ - Serializer#attribute
295
+ - Serializer#include\_#{name}? (filter method added)
296
+ - Serializer#attributes (took a hash)
297
+
298
+ * The following things were added
299
+ - Serializer#filter method
300
+ - CONFIG object
301
+
302
+ * Remove support for ruby 1.8 versions.
303
+
304
+ * Require rails >= 3.2.
305
+
306
+ * Serializers for associations are being looked up in a parent serializer's namespace first. Same with controllers' namespaces.
307
+
308
+ * Added a "prefix" option in case you want to use a different version of serializer.
309
+
310
+ * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
311
+
312
+ ## 0.08.x
313
+
314
+ ### v0.8.3 (2014/12/10 14:45 +00:00)
315
+ - [#753](https://github.com/rails-api/active_model_serializers/pull/753) Test against Ruby 2.2 on Travis CI (@tricknotes)
316
+ - [#745](https://github.com/rails-api/active_model_serializers/pull/745) Missing a word (@jockee)
317
+
318
+ ### v0.8.2 (2014/09/01 21:00 +00:00)
319
+ - [#612](https://github.com/rails-api/active_model_serializers/pull/612) Feature/adapter (@bolshakov)
3
320
  * adds adapters pattern
4
- * adds support for `meta` and `meta_key` [@kurko]
5
- * adds method to override association [@kurko]
6
- * adds `has_one` attribute for backwards compatibility [@ggordon]
7
- * adds JSON API support 1.0 [@benedikt]
8
- * adds fragment cache support [@joaomdmoura]
9
- * adds cache support to attributes and associations [@joaomdmoura]
10
- * uses model name to determine the type [@lsylvester]
11
- * remove root key option and split JSON adapter [@joaomdmoura]
12
- * adds FlattenJSON as default adapter [@joaomdmoura]
13
- * adds support for `pagination links` at top level of JsonApi adapter [@bacarini]
14
- * adds extended format for `include` option to JSONAPI adapter [@beauby]
321
+ - [#615](https://github.com/rails-api/active_model_serializers/pull/615) Rails does not support const_defined? in development mode (@tpitale)
322
+ - [#613](https://github.com/rails-api/active_model_serializers/pull/613) README: typo fix on attributes (@spk)
323
+ - [#614](https://github.com/rails-api/active_model_serializers/pull/614) Fix rails 4.0.x build. (@arthurnn)
324
+ - [#610](https://github.com/rails-api/active_model_serializers/pull/610) ArraySerializer (@bolshakov)
325
+ - [#607](https://github.com/rails-api/active_model_serializers/pull/607) ruby syntax highlights (@zigomir)
326
+ - [#602](https://github.com/rails-api/active_model_serializers/pull/602) Add DSL for associations (@JordanFaust)
327
+
328
+ ### 0.8.1 (May 6, 2013)
329
+
330
+ * Fix bug whereby a serializer using 'options' would blow up.
331
+
332
+ ### 0.8.0 (May 5, 2013)
333
+
334
+ * Attributes can now have optional types.
335
+
336
+ * A new DefaultSerializer ensures that POROs behave the same way as ActiveModels.
337
+
338
+ * If you wish to override ActiveRecord::Base#to_Json, you can now require
339
+ 'active_record/serializer_override'. We don't recommend you do this, but
340
+ many users do, so we've left it optional.
341
+
342
+ * Fixed a bug where ActionController wouldn't always have MimeResponds.
343
+
344
+ * An optinal caching feature allows you to cache JSON & hashes that AMS uses.
345
+ Adding 'cached true' to your Serializers will turn on this cache.
346
+
347
+ * URL helpers used inside of Engines now work properly.
348
+
349
+ * Serializers now can filter attributes with `only` and `except`:
350
+
351
+ ```
352
+ UserSerializer.new(user, only: [:first_name, :last_name])
353
+ UserSerializer.new(user, except: :first_name)
354
+ ```
355
+
356
+ * Basic Mongoid support. We now include our mixins in the right place.
357
+
358
+ * On Ruby 1.8, we now generate an `id` method that properly serializes `id`
359
+ columns. See issue #127 for more.
360
+
361
+ * Add an alias for `scope` method to be the name of the context. By default
362
+ this is `current_user`. The name is automatically set when using
363
+ `serialization_scope` in the controller.
364
+
365
+ * Pass through serialization options (such as `:include`) when a model
366
+ has no serializer defined.
367
+
368
+ ## [0.7.0 (March 6, 2013)](https://github.com/rails-api/active_model_serializers/commit/fabdc621ff97fbeca317f6301973dd4564b9e695)
369
+
370
+ * ```embed_key``` option to allow embedding by attributes other than IDs
371
+ * Fix rendering nil with custom serializer
372
+ * Fix global ```self.root = false```
373
+ * Add support for specifying the serializer for an association as a String
374
+ * Able to specify keys on the attributes method
375
+ * Serializer Reloading via ActiveSupport::DescendantsTracker
376
+ * Reduce double map to once; Fixes datamapper eager loading.
377
+
378
+ ## 0.6.0 (October 22, 2012)
379
+
380
+ * Serialize sets properly
381
+ * Add root option to ArraySerializer
382
+ * Support polymorphic associations
383
+ * Support :each_serializer in ArraySerializer
384
+ * Add `scope` method to easily access the scope in the serializer
385
+ * Fix regression with Rails 3.2.6; add Rails 4 support
386
+ * Allow serialization_scope to be disabled with serialization_scope nil
387
+ * Array serializer should support pure ruby objects besides serializers
388
+
389
+ ## 0.05.x
390
+
391
+ ### [0.5.2 (June 5, 2012)](https://github.com/rails-api/active_model_serializers/commit/615afd125c260432d456dc8be845867cf87ea118#diff-0c5c12f311d3b54734fff06069efd2ac)
392
+
393
+ ### [0.5.1 (May 23, 2012)](https://github.com/rails-api/active_model_serializers/commit/00194ec0e41831802fcbf893a34c0bb0853ebe14#diff-0c5c12f311d3b54734fff06069efd2ac)
394
+
395
+ ### [0.5.0 (May 16, 2012)](https://github.com/rails-api/active_model_serializers/commit/33d4842dcd35c7167b0b33fc0abcf00fb2c92286)
396
+
397
+ * First tagged version
398
+ * Changes generators to always generate an ApplicationSerializer
399
+
400
+ ## [0.1.0 (December 21, 2011)](https://github.com/rails-api/active_model_serializers/commit/1e0c9ef93b96c640381575dcd30be07ac946818b)
401
+
402
+ ## First Commit as [Rails Serializers 0.0.1](https://github.com/rails-api/active_model_serializers/commit/d72b66d4c5355b0ff0a75a04895fcc4ea5b0c65e)
403
+ (December 1, 2011).
404
+
405
+ ## Prehistory
406
+
407
+ - [Changing Serialization/Serializers namespace to `Serializable` (November 30, 2011)](https://github.com/rails/rails/commit/8896b4fdc8a543157cdf4dfc378607ebf6c10ab0)
408
+ - [Merge branch 'serializers'. This implements the ActiveModel::Serializer object. Includes code, tests, generators and guides. From José and Yehuda with love.](https://github.com/rails/rails/commit/fcacc6986ab60f1fb2e423a73bf47c7abd7b191d)
409
+ - But [was reverted](https://github.com/rails/rails/commit/5b2eb64ceb08cd005dc06b721935de5853971473).
410
+ '[Revert the serializers API as other alternatives are now also under discussion](https://github.com/rails/rails/commit/0a4035b12a6c59253cb60f9e3456513c6a6a9d33)'.
411
+ - [Proposed Implementation to Rails 3.2 by @wycats and @josevalim (November 25, 2011)](https://github.com/rails/rails/pull/3753)
412
+ - [Creation of `ActionController::Serialization`, initial serializer
413
+ support (September, 26 2011)](https://github.com/rails/rails/commit/8ff7693a8dc61f43fc4eaf72ed24d3b8699191fe0).
414
+ - [Docs and CHANGELOG](https://github.com/rails/rails/commit/696d01f7f4a8ed787924a41cce6df836cd73c46f)
415
+ - [Deprecation of ActiveModel::Serialization to ActiveModel::Serializable](https://github.com/rails/rails/blob/696d01f7f4a8ed787924a41cce6df836cd73c46f/activemodel/lib/active_model/serialization.rb)
416
+ - [Creation of `ActiveModel::Serialization` from `ActiveModel::Serializer` in Rails (2009)](https://github.com/rails/rails/commit/c6bc8e662614be711f45a8d4b231d5f993b024a7#diff-d029b9768d8df0407a35804a468e3ae5)
417
+ - [Integration of `ActiveModel::Serializer` into `ActiveRecord::Serialization`](https://github.com/rails/rails/commit/783db25e0c640c1588732967a87d65c10fddc08e)
418
+ - [Creation of `ActiveModel::Serializer` in Rails (2009)](https://github.com/rails/rails/commit/d2b78b3594b9cc9870e6a6ebfeb2e56d00e6ddb8#diff-80d5beeced9bdc24ca2b04a201543bdd)
419
+ - [Creation of `ActiveModel::Serializers::JSON` in Rails (2009)](https://github.com/rails/rails/commit/fbdf706fffbfb17731a1f459203d242414ef5086)