active_model_serializers 0.8.3 → 0.10.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.rubocop.yml +86 -0
  4. data/.rubocop_todo.yml +240 -0
  5. data/.simplecov +111 -0
  6. data/.travis.yml +33 -22
  7. data/CHANGELOG.md +358 -6
  8. data/CONTRIBUTING.md +220 -0
  9. data/Gemfile +46 -1
  10. data/{MIT-LICENSE.txt → LICENSE.txt} +3 -2
  11. data/README.md +81 -591
  12. data/Rakefile +68 -11
  13. data/active_model_serializers.gemspec +57 -23
  14. data/appveyor.yml +27 -0
  15. data/docs/ARCHITECTURE.md +120 -0
  16. data/docs/DESIGN.textile +8 -0
  17. data/docs/README.md +35 -0
  18. data/docs/general/adapters.md +162 -0
  19. data/docs/general/caching.md +52 -0
  20. data/docs/general/configuration_options.md +27 -0
  21. data/docs/general/getting_started.md +98 -0
  22. data/docs/general/instrumentation.md +40 -0
  23. data/docs/general/logging.md +14 -0
  24. data/docs/general/rendering.md +153 -0
  25. data/docs/general/serializers.md +207 -0
  26. data/docs/how-open-source-maintained.jpg +0 -0
  27. data/docs/howto/add_pagination_links.md +121 -0
  28. data/docs/howto/add_root_key.md +51 -0
  29. data/docs/howto/outside_controller_use.md +58 -0
  30. data/docs/howto/test.md +152 -0
  31. data/docs/integrations/ember-and-json-api.md +112 -0
  32. data/docs/integrations/grape.md +19 -0
  33. data/docs/jsonapi/schema/schema.json +366 -0
  34. data/docs/jsonapi/schema.md +140 -0
  35. data/lib/action_controller/serialization.rb +41 -37
  36. data/lib/active_model/serializable_resource.rb +72 -0
  37. data/lib/active_model/serializer/adapter/attributes.rb +66 -0
  38. data/lib/active_model/serializer/adapter/base.rb +58 -0
  39. data/lib/active_model/serializer/adapter/cached_serializer.rb +45 -0
  40. data/lib/active_model/serializer/adapter/fragment_cache.rb +111 -0
  41. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +13 -0
  42. data/lib/active_model/serializer/adapter/json.rb +21 -0
  43. data/lib/active_model/serializer/adapter/json_api/deserialization.rb +207 -0
  44. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +21 -0
  45. data/lib/active_model/serializer/adapter/json_api/link.rb +44 -0
  46. data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +58 -0
  47. data/lib/active_model/serializer/adapter/json_api.rb +223 -0
  48. data/lib/active_model/serializer/adapter/null.rb +11 -0
  49. data/lib/active_model/serializer/adapter.rb +91 -0
  50. data/lib/active_model/serializer/array_serializer.rb +9 -0
  51. data/lib/active_model/serializer/association.rb +20 -0
  52. data/lib/active_model/serializer/associations.rb +87 -220
  53. data/lib/active_model/serializer/attribute.rb +25 -0
  54. data/lib/active_model/serializer/attributes.rb +82 -0
  55. data/lib/active_model/serializer/belongs_to_reflection.rb +10 -0
  56. data/lib/active_model/serializer/caching.rb +100 -0
  57. data/lib/active_model/serializer/collection_reflection.rb +7 -0
  58. data/lib/active_model/serializer/collection_serializer.rb +47 -0
  59. data/lib/active_model/serializer/configuration.rb +28 -0
  60. data/lib/active_model/serializer/field.rb +56 -0
  61. data/lib/active_model/serializer/fieldset.rb +31 -0
  62. data/lib/active_model/serializer/has_many_reflection.rb +10 -0
  63. data/lib/active_model/serializer/has_one_reflection.rb +10 -0
  64. data/lib/active_model/serializer/include_tree.rb +111 -0
  65. data/lib/active_model/serializer/links.rb +33 -0
  66. data/lib/active_model/serializer/lint.rb +142 -0
  67. data/lib/active_model/serializer/reflection.rb +91 -0
  68. data/lib/active_model/serializer/singular_reflection.rb +7 -0
  69. data/lib/active_model/serializer/type.rb +25 -0
  70. data/lib/active_model/{serializers → serializer}/version.rb +1 -1
  71. data/lib/active_model/serializer.rb +99 -479
  72. data/lib/active_model_serializers/callbacks.rb +55 -0
  73. data/lib/active_model_serializers/deserialization.rb +13 -0
  74. data/lib/active_model_serializers/logging.rb +119 -0
  75. data/lib/active_model_serializers/model.rb +39 -0
  76. data/lib/active_model_serializers/railtie.rb +38 -0
  77. data/lib/active_model_serializers/serialization_context.rb +10 -0
  78. data/lib/active_model_serializers/test/schema.rb +103 -0
  79. data/lib/active_model_serializers/test/serializer.rb +125 -0
  80. data/lib/active_model_serializers/test.rb +7 -0
  81. data/lib/active_model_serializers.rb +20 -92
  82. data/lib/generators/rails/USAGE +6 -0
  83. data/lib/generators/rails/resource_override.rb +10 -0
  84. data/lib/generators/rails/serializer_generator.rb +36 -0
  85. data/lib/generators/rails/templates/serializer.rb.erb +8 -0
  86. data/lib/grape/active_model_serializers.rb +14 -0
  87. data/lib/grape/formatters/active_model_serializers.rb +15 -0
  88. data/lib/grape/helpers/active_model_serializers.rb +16 -0
  89. data/test/action_controller/adapter_selector_test.rb +53 -0
  90. data/test/action_controller/explicit_serializer_test.rb +134 -0
  91. data/test/action_controller/json/include_test.rb +167 -0
  92. data/test/action_controller/json_api/deserialization_test.rb +59 -0
  93. data/test/action_controller/json_api/linked_test.rb +196 -0
  94. data/test/action_controller/json_api/pagination_test.rb +116 -0
  95. data/test/{serialization_scope_name_test.rb → action_controller/serialization_scope_name_test.rb} +11 -15
  96. data/test/action_controller/serialization_test.rb +435 -0
  97. data/test/active_model_serializers/logging_test.rb +77 -0
  98. data/test/active_model_serializers/model_test.rb +9 -0
  99. data/test/active_model_serializers/railtie_test_isolated.rb +57 -0
  100. data/test/active_model_serializers/serialization_context_test.rb +18 -0
  101. data/test/active_model_serializers/test/schema_test.rb +128 -0
  102. data/test/active_model_serializers/test/serializer_test.rb +63 -0
  103. data/test/active_record_test.rb +9 -0
  104. data/test/adapter/fragment_cache_test.rb +38 -0
  105. data/test/adapter/json/belongs_to_test.rb +47 -0
  106. data/test/adapter/json/collection_test.rb +92 -0
  107. data/test/adapter/json/has_many_test.rb +47 -0
  108. data/test/adapter/json_api/belongs_to_test.rb +157 -0
  109. data/test/adapter/json_api/collection_test.rb +97 -0
  110. data/test/adapter/json_api/fields_test.rb +89 -0
  111. data/test/adapter/json_api/has_many_embed_ids_test.rb +45 -0
  112. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +98 -0
  113. data/test/adapter/json_api/has_many_test.rb +145 -0
  114. data/test/adapter/json_api/has_one_test.rb +81 -0
  115. data/test/adapter/json_api/json_api_test.rb +37 -0
  116. data/test/adapter/json_api/linked_test.rb +394 -0
  117. data/test/adapter/json_api/links_test.rb +68 -0
  118. data/test/adapter/json_api/pagination_links_test.rb +115 -0
  119. data/test/adapter/json_api/parse_test.rb +139 -0
  120. data/test/adapter/json_api/resource_type_config_test.rb +71 -0
  121. data/test/adapter/json_api/toplevel_jsonapi_test.rb +84 -0
  122. data/test/adapter/json_test.rb +47 -0
  123. data/test/adapter/null_test.rb +25 -0
  124. data/test/adapter_test.rb +42 -0
  125. data/test/array_serializer_test.rb +36 -73
  126. data/test/collection_serializer_test.rb +100 -0
  127. data/test/fixtures/active_record.rb +56 -0
  128. data/test/fixtures/poro.rb +229 -0
  129. data/test/generators/scaffold_controller_generator_test.rb +24 -0
  130. data/test/generators/serializer_generator_test.rb +57 -0
  131. data/test/grape_test.rb +82 -0
  132. data/test/include_tree/from_include_args_test.rb +26 -0
  133. data/test/include_tree/from_string_test.rb +94 -0
  134. data/test/include_tree/include_args_to_hash_test.rb +64 -0
  135. data/test/lint_test.rb +40 -0
  136. data/test/logger_test.rb +18 -0
  137. data/test/poro_test.rb +9 -0
  138. data/test/serializable_resource_test.rb +27 -0
  139. data/test/serializers/adapter_for_test.rb +166 -0
  140. data/test/serializers/association_macros_test.rb +36 -0
  141. data/test/serializers/associations_test.rb +267 -0
  142. data/test/serializers/attribute_test.rb +123 -0
  143. data/test/serializers/attributes_test.rb +52 -0
  144. data/test/serializers/cache_test.rb +209 -0
  145. data/test/serializers/configuration_test.rb +32 -0
  146. data/test/serializers/fieldset_test.rb +14 -0
  147. data/test/serializers/meta_test.rb +130 -0
  148. data/test/serializers/options_test.rb +21 -0
  149. data/test/serializers/root_test.rb +21 -0
  150. data/test/serializers/serializer_for_test.rb +134 -0
  151. data/test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  152. data/test/support/isolated_unit.rb +77 -0
  153. data/test/support/rails5_shims.rb +29 -0
  154. data/test/support/rails_app.rb +25 -0
  155. data/test/support/schemas/active_model_serializers/test/schema_test/my/index.json +6 -0
  156. data/test/support/schemas/active_model_serializers/test/schema_test/my/show.json +6 -0
  157. data/test/support/schemas/custom/show.json +7 -0
  158. data/test/support/schemas/hyper_schema.json +93 -0
  159. data/test/support/schemas/render_using_json_api.json +43 -0
  160. data/test/support/schemas/simple_json_pointers.json +10 -0
  161. data/test/support/serialization_testing.rb +53 -0
  162. data/test/support/simplecov.rb +6 -0
  163. data/test/support/stream_capture.rb +50 -0
  164. data/test/support/test_case.rb +19 -0
  165. data/test/test_helper.rb +55 -24
  166. metadata +358 -42
  167. data/DESIGN.textile +0 -586
  168. data/Gemfile.edge +0 -9
  169. data/bench/perf.rb +0 -43
  170. data/cruft.md +0 -19
  171. data/lib/active_model/array_serializer.rb +0 -104
  172. data/lib/active_record/serializer_override.rb +0 -16
  173. data/lib/generators/resource_override.rb +0 -13
  174. data/lib/generators/serializer/USAGE +0 -9
  175. data/lib/generators/serializer/serializer_generator.rb +0 -42
  176. data/lib/generators/serializer/templates/serializer.rb +0 -19
  177. data/test/association_test.rb +0 -592
  178. data/test/caching_test.rb +0 -96
  179. data/test/generators_test.rb +0 -85
  180. data/test/no_serialization_scope_test.rb +0 -34
  181. data/test/serialization_test.rb +0 -392
  182. data/test/serializer_support_test.rb +0 -51
  183. data/test/serializer_test.rb +0 -1465
  184. data/test/test_fakes.rb +0 -217
data/CHANGELOG.md CHANGED
@@ -1,10 +1,335 @@
1
- # UNRELEASED
1
+ ## 0.10.x
2
2
 
3
- # VERSION 0.8.1
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)
320
+ * adds adapters pattern
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)
4
329
 
5
330
  * Fix bug whereby a serializer using 'options' would blow up.
6
331
 
7
- # VERSION 0.8.0
332
+ ### 0.8.0 (May 5, 2013)
8
333
 
9
334
  * Attributes can now have optional types.
10
335
 
@@ -40,7 +365,7 @@
40
365
  * Pass through serialization options (such as `:include`) when a model
41
366
  has no serializer defined.
42
367
 
43
- # VERSION 0.7.0
368
+ ## [0.7.0 (March 6, 2013)](https://github.com/rails-api/active_model_serializers/commit/fabdc621ff97fbeca317f6301973dd4564b9e695)
44
369
 
45
370
  * ```embed_key``` option to allow embedding by attributes other than IDs
46
371
  * Fix rendering nil with custom serializer
@@ -50,7 +375,7 @@
50
375
  * Serializer Reloading via ActiveSupport::DescendantsTracker
51
376
  * Reduce double map to once; Fixes datamapper eager loading.
52
377
 
53
- # VERSION 0.6.0
378
+ ## 0.6.0 (October 22, 2012)
54
379
 
55
380
  * Serialize sets properly
56
381
  * Add root option to ArraySerializer
@@ -61,7 +386,34 @@
61
386
  * Allow serialization_scope to be disabled with serialization_scope nil
62
387
  * Array serializer should support pure ruby objects besides serializers
63
388
 
64
- # VERSION 0.5.0 (May 16, 2012)
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)
65
396
 
66
397
  * First tagged version
67
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)
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,220 @@
1
+ First of all, **thank you**!
2
+
3
+ ![Commit Strip
4
+ http://www.commitstrip.com/en/2014/05/07/the-truth-behind-open-source-apps/](docs/how-open-source-maintained.jpg)
5
+
6
+ ## Common issues and resolutions
7
+
8
+ - Using `grape-active_model_serializers`, or any non-Rails server. See
9
+ [issue](https://github.com/rails-api/active_model_serializers/issues/1258).
10
+
11
+ ## How can I help?
12
+
13
+ - [Filing an issue](CONTRIBUTING.md#filing-an-issue)
14
+ - [Writing code and comments](CONTRIBUTING.md#writing-code-and-comments)
15
+
16
+ ### Filing an issue
17
+
18
+ Everyone is encouraged to open issues that are affecting them:
19
+ bugs, ideas, documentation (`/docs`), performance problems – everything helps!
20
+
21
+ #### Before
22
+
23
+ 1. Start by looking at our [GitHub Issues](https://github.com/rails-api/active_model_serializers/issues).
24
+
25
+ - Check if your issue has already been reported.
26
+ - If you find an existing issue report, feel free to add further information to that report.
27
+
28
+ #### Writing
29
+
30
+ If possible, please include the following information when [reporting an
31
+ issue](https://github.com/rails-api/active_model_serializers/issues/new):
32
+
33
+ - ActiveModelSerializers version (0.8.x, 0.9.x, 0.10.x, commit ref).
34
+ - What are you using ActiveModelSerializers with? Rails? Grape? Other? Which versions?
35
+ - If you are not running the latest version (please check), and you cannot update it,
36
+ please specify in your report why you can't update to the latest version.
37
+ - Operating system type + version.
38
+ - Ruby version with patch level. And whether you're using rvm, rbenv, etc.
39
+ - Include `ruby -e "puts RUBY_DESCRIPTION"`.
40
+ - Clearly-written steps to reproduce the issue (i.e. "Show me how to show myself." ), including:
41
+ - What were you doing? Include code if possible.
42
+ - Command line parameters used, if any.
43
+ - RubyGems code in your Gemfile, if any. Gemfile.lock, if possible.
44
+ - Any configuration you've made.
45
+ - What did you expect to happen?
46
+ - What happened? Include as much information as possible.
47
+ - Nature of reported defect (e.g. user name missing, not "It doesn't work."). Is it intermittent?
48
+ - The best help here is a failing test. Even better if it's a PR.
49
+ - Then the steps to reproduce and/or a gist or repository that demonstrates the defect.
50
+ - Then examples of the code you were using.
51
+ - Any error messages (including stacktrace, i.e. "Show me the error.")
52
+ - Things you've tried.
53
+ - A pull request for your fix would be great. Code should have tests.
54
+ - Link to source code, if available.
55
+
56
+ Please make sure only to include one issue per report.
57
+ If you encounter multiple, unrelated issues, please report them as such.
58
+
59
+ Simon Tatham has written an excellent on article on
60
+ [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
61
+ which is [well worth reading](http://yourbugreportneedsmore.info/), although it is not specific to ActiveModelSerializers.
62
+
63
+ Include as much sample code as you can to help us reproduce the issue. (Inline, repo link, or gist, are fine. A failing test would help the most.)
64
+
65
+ This is extremely important for narrowing down the cause of your problem.
66
+
67
+ Thanks!
68
+
69
+ Sometimes an issue will be closed by a maintainer for various reasons. In some cases, this is
70
+ an invitation to make a better case for your issue or be able to reproduce a bug, and
71
+ its being close is just an opportunity to help out some more, and then re-open.
72
+
73
+ #### After
74
+
75
+ Thanks to everyone involved!
76
+
77
+ If you get help, sharing it back in the form of a pull-request or making an issue to document
78
+ what you've found is *extremely* helpful.
79
+
80
+ If you solve your issue, stop working on it, or realize the problem was something else,
81
+ please share that in a comment to an issue and close it. That way, everyone can learn and
82
+ we don't have closed issues without a clear resolution. Even if it's just a stackoverflow link :)
83
+ And please don't forget to stay involved in the issue until it is closed! Thanks to all!
84
+
85
+ ### Writing code and comments
86
+
87
+ - We are actively working to identify tasks under the label [**Good for New
88
+ Contributors**](https://github.com/rails-api/active_model_serializers/labels/Good%20for%20New%20Contributors).
89
+ - [Changelog
90
+ Missing](https://github.com/rails-api/active_model_serializers/issues?q=label%3A%22Changelog+Missing%22+is%3Aclosed) is
91
+ an easy way to help out.
92
+
93
+ - [Fix a bug](https://github.com/rails-api/active_model_serializers/labels/Ready%20for%20PR).
94
+ - Ready for PR - A well defined bug, needs someone to PR a fix.
95
+ - Bug - Anything that is broken.
96
+ - Regression - A bug that did not exist in previous versions and isn't a new feature (applied in tandem with Bug).
97
+ - Performance - A performance related issue. We could track this as a bug, but usually these would have slightly lower priority than standard bugs.
98
+
99
+ - [Develop new features](https://github.com/rails-api/active_model_serializers/labels/Feature).
100
+
101
+ - [Improve code quality](https://codeclimate.com/github/rails-api/active_model_serializers/code?sort=smell_count&sort_direction=desc).
102
+
103
+ - [Improve amount of code exercised by tests](https://codeclimate.com/github/rails-api/active_model_serializers/coverage?sort=covered_percent&sort_direction=asc).
104
+
105
+ - [Fix RuboCop (Style) TODOS](https://github.com/rails-api/active_model_serializers/blob/master/.rubocop_todo.yml).
106
+ - Delete and offsense, run `rake rubocop` (or possibly `rake rubocop:auto_correct`),
107
+ and [submit a PR](CONTRIBUTING.md#submitting-a-pull-request-pr).
108
+
109
+ - We are also encouraging comments to substantial changes (larger than bugfixes and simple features) under an
110
+ "RFC" (Request for Comments) process before we start active development.
111
+ Look for the [**RFC**](https://github.com/rails-api/active_model_serializers/labels/RFC) label.
112
+
113
+ #### Submitting a pull request (PR)
114
+
115
+ 1. The vast majority of development is happening under the `master` branch.
116
+ This is where we would suggest you start.
117
+ 1. Fixing bugs is extraordinarily helpful and requires the least familiarity with ActiveModelSerializers.
118
+ Look for issues labeled [**Needs Bug Verification**](https://github.com/rails-api/active_model_serializers/labels/Needs%20Bug%20Verification) and [**Bug**](https://github.com/rails-api/active_model_serializers/labels/bug).
119
+ 1. Adding or fixing documentation is also fantastic!
120
+
121
+ To fetch & test the library for development, do:
122
+
123
+ 1. Fork the repository ( https://github.com/rails-api/active_model_serializers/fork )
124
+ 1. `git clone https://github.com/{whoami}/active_model_serializers.git`
125
+ 1. `cd active_model_serializers`
126
+ 1. `bundle`
127
+ - To test against a particular rails version-- 4.0 is usually the most buggy-- set then
128
+ RAILS_VERSION environment variable as described in the [.travis.yml](.travis.yml).
129
+ e.g. `export RAILS_VERSION=4.0`.
130
+ 1. Create your PR branch (`git checkout -b my-helpful-pr`)
131
+ 1. Write tests for your feature, or regression tests highlighting a bug.
132
+ This is important so ActiveModelSerializers doesn't break it in a future version unintentionally.
133
+ 1. Write the feature itself, or fix your bug
134
+ 1. `bundle exec rake`
135
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
136
+ - Use well-described, small (atomic) commits.
137
+ 1. Push to the branch (`git push origin my-helpful-pr`)
138
+ 1. Create a new Pull Request
139
+ - Include links to any relevant github issues.
140
+ - *Don't* change the VERSION file.
141
+ - Update `/docs` to include, whenever possible, a new, suitable recommendation about how to use
142
+ the feature.
143
+ - Extra Credit: [Confirm it runs and tests pass on the rubies specified in the travis
144
+ config](.travis.yml). A maintainer will otherwise confirm it runs on these.
145
+
146
+ 1. *Bonus Points* Update [CHANGELOG.md](https://github.com/rails-api/active_model_serializers/blob/master/CHANGELOG.md)
147
+ with a brief description of any breaking changes, fixes, features, or
148
+ miscellaneous changes under the proper version section.
149
+ 1. Iterate on feedback given by the community (fix syntax, modify bits of code, add
150
+ tests), pushing the new commits to the PR each time
151
+
152
+ Remember to [squash your commits](CONTRIBUTING.md#about-pull-requests-prs) and rebase off `master`.
153
+
154
+ #### How maintainers handle pull requests:
155
+
156
+ - If the tests pass and the pull request looks good, a maintainer will merge it.
157
+ - If the pull request needs to be changed,
158
+ - you can change it by updating the branch you generated the pull request from
159
+ - either by adding more commits, or
160
+ - by force pushing to it
161
+ - A maintainer can make any changes themselves and manually merge the code in.
162
+
163
+ #### Commit Messages
164
+
165
+ - [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
166
+ - [http://stopwritingramblingcommitmessages.com/](http://stopwritingramblingcommitmessages.com/)
167
+ - [ThoughtBot style guide](https://github.com/thoughtbot/guides/tree/master/style#git)
168
+
169
+ #### About Pull Requests (PR's)
170
+
171
+ - [Using Pull Requests](https://help.github.com/articles/using-pull-requests)
172
+ - [Github pull requests made easy](http://www.element84.com/github-pull-requests-made-easy.html)
173
+ - [Exercism Git Workflow](http://help.exercism.io/git-workflow.html).
174
+ - [Level up your Git](http://rakeroutes.com/blog/deliberate-git/)
175
+ - [All Your Open Source Code Are Belong To Us](http://www.benjaminfleischer.com/2013/07/30/all-your-open-source-code-are-belong-to-us/)
176
+
177
+ ## Issue Labeling
178
+
179
+ ActiveModelSerializers uses a subset of [StandardIssueLabels](https://github.com/wagenet/StandardIssueLabels) for Github Issues. You can [see our labels here](https://github.com/rails-api/active_model_serializers/labels).
180
+
181
+ ## Running tests
182
+
183
+ Run tests against different Rails versions by setting the RAILS_VERSION variable
184
+ and bundling gems. To test against all versions, you can do something like:
185
+
186
+ ```bash
187
+ for version in 4.0 4.1 4.2 master; do
188
+ export RAILS_VERSION="$version"
189
+ rm -f Gemfile.lock
190
+ bundle check || bundle --local || bundle
191
+ bundle exec rake test
192
+ if [ "$?" -eq 0 ]; then
193
+ # green in ANSI
194
+ echo -e "\033[32m **** Tests passed against Rails ${RAILS_VERSION} **** \033[0m"
195
+ else
196
+ # red in ANSI
197
+ echo -e "\033[31m **** Tests failed against Rails ${RAILS_VERSION} **** \033[0m"
198
+ fi
199
+ unset RAILS_VERSION
200
+ done
201
+ ```
202
+
203
+
204
+ ### Running with Rake
205
+
206
+ The easiest way to run the unit tests is through Rake. The default task runs
207
+ the entire test suite for all classes. For more information, checkout the
208
+ full array of rake tasks with "rake -T"
209
+
210
+ Rake can be found at http://docs.seattlerb.org/rake/.
211
+
212
+ To run a single test suite
213
+
214
+ `$ rake test TEST=path/to/test.rb`
215
+
216
+ Which can be further narrowed down to one test:
217
+
218
+ `$ rake test TEST=path/to/test.rb TESTOPTS="--name=test_something"`
219
+
220
+ :heart: :sparkling_heart: :heart: