active_model_serializers 0.10.0.rc4 → 0.10.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +29 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +15 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +19 -1
  6. data/.rubocop_todo.yml +30 -103
  7. data/.simplecov +0 -1
  8. data/.travis.yml +20 -8
  9. data/CHANGELOG.md +89 -5
  10. data/CONTRIBUTING.md +54 -179
  11. data/Gemfile +7 -2
  12. data/{LICENSE.txt → MIT-LICENSE} +0 -0
  13. data/README.md +27 -5
  14. data/Rakefile +44 -16
  15. data/active_model_serializers.gemspec +9 -1
  16. data/appveyor.yml +1 -0
  17. data/bin/bench +171 -0
  18. data/bin/bench_regression +316 -0
  19. data/bin/serve_benchmark +39 -0
  20. data/docs/ARCHITECTURE.md +13 -7
  21. data/docs/README.md +5 -1
  22. data/docs/STYLE.md +58 -0
  23. data/docs/general/adapters.md +99 -16
  24. data/docs/general/configuration_options.md +87 -14
  25. data/docs/general/deserialization.md +100 -0
  26. data/docs/general/getting_started.md +35 -0
  27. data/docs/general/instrumentation.md +1 -1
  28. data/docs/general/key_transforms.md +40 -0
  29. data/docs/general/rendering.md +115 -13
  30. data/docs/general/serializers.md +138 -6
  31. data/docs/howto/add_pagination_links.md +36 -18
  32. data/docs/howto/outside_controller_use.md +4 -4
  33. data/docs/howto/passing_arbitrary_options.md +27 -0
  34. data/docs/jsonapi/errors.md +56 -0
  35. data/docs/jsonapi/schema.md +29 -18
  36. data/docs/rfcs/0000-namespace.md +106 -0
  37. data/docs/rfcs/template.md +15 -0
  38. data/lib/action_controller/serialization.rb +10 -19
  39. data/lib/active_model/serializable_resource.rb +4 -65
  40. data/lib/active_model/serializer.rb +73 -18
  41. data/lib/active_model/serializer/adapter.rb +15 -82
  42. data/lib/active_model/serializer/adapter/attributes.rb +5 -56
  43. data/lib/active_model/serializer/adapter/base.rb +5 -47
  44. data/lib/active_model/serializer/adapter/json.rb +6 -12
  45. data/lib/active_model/serializer/adapter/json_api.rb +5 -213
  46. data/lib/active_model/serializer/adapter/null.rb +7 -3
  47. data/lib/active_model/serializer/array_serializer.rb +3 -3
  48. data/lib/active_model/serializer/association.rb +4 -5
  49. data/lib/active_model/serializer/attributes.rb +1 -1
  50. data/lib/active_model/serializer/caching.rb +56 -5
  51. data/lib/active_model/serializer/collection_serializer.rb +30 -13
  52. data/lib/active_model/serializer/configuration.rb +7 -0
  53. data/lib/active_model/serializer/error_serializer.rb +10 -0
  54. data/lib/active_model/serializer/errors_serializer.rb +27 -0
  55. data/lib/active_model/serializer/links.rb +4 -2
  56. data/lib/active_model/serializer/lint.rb +14 -0
  57. data/lib/active_model/serializer/meta.rb +29 -0
  58. data/lib/active_model/serializer/null.rb +17 -0
  59. data/lib/active_model/serializer/reflection.rb +57 -1
  60. data/lib/active_model/serializer/type.rb +1 -1
  61. data/lib/active_model/serializer/version.rb +1 -1
  62. data/lib/active_model_serializers.rb +17 -0
  63. data/lib/active_model_serializers/adapter.rb +92 -0
  64. data/lib/active_model_serializers/adapter/attributes.rb +94 -0
  65. data/lib/active_model_serializers/adapter/base.rb +90 -0
  66. data/lib/active_model_serializers/adapter/json.rb +11 -0
  67. data/lib/active_model_serializers/adapter/json_api.rb +513 -0
  68. data/lib/active_model_serializers/adapter/json_api/deserialization.rb +213 -0
  69. data/lib/active_model_serializers/adapter/json_api/error.rb +96 -0
  70. data/lib/active_model_serializers/adapter/json_api/jsonapi.rb +49 -0
  71. data/lib/active_model_serializers/adapter/json_api/link.rb +83 -0
  72. data/lib/active_model_serializers/adapter/json_api/meta.rb +37 -0
  73. data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +57 -0
  74. data/lib/active_model_serializers/adapter/json_api/relationship.rb +52 -0
  75. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +37 -0
  76. data/lib/active_model_serializers/adapter/null.rb +10 -0
  77. data/lib/active_model_serializers/cached_serializer.rb +87 -0
  78. data/lib/active_model_serializers/callbacks.rb +1 -1
  79. data/lib/active_model_serializers/deprecate.rb +55 -0
  80. data/lib/active_model_serializers/deserialization.rb +2 -2
  81. data/lib/active_model_serializers/fragment_cache.rb +118 -0
  82. data/lib/active_model_serializers/json_pointer.rb +14 -0
  83. data/lib/active_model_serializers/key_transform.rb +70 -0
  84. data/lib/active_model_serializers/logging.rb +4 -1
  85. data/lib/active_model_serializers/model.rb +11 -1
  86. data/lib/active_model_serializers/railtie.rb +9 -1
  87. data/lib/active_model_serializers/register_jsonapi_renderer.rb +64 -0
  88. data/lib/active_model_serializers/serializable_resource.rb +81 -0
  89. data/lib/active_model_serializers/serialization_context.rb +24 -2
  90. data/lib/active_model_serializers/test/schema.rb +2 -2
  91. data/lib/grape/formatters/active_model_serializers.rb +1 -1
  92. data/test/action_controller/adapter_selector_test.rb +1 -1
  93. data/test/action_controller/json_api/deserialization_test.rb +56 -3
  94. data/test/action_controller/json_api/errors_test.rb +41 -0
  95. data/test/action_controller/json_api/linked_test.rb +10 -9
  96. data/test/action_controller/json_api/pagination_test.rb +2 -2
  97. data/test/action_controller/json_api/transform_test.rb +180 -0
  98. data/test/action_controller/serialization_scope_name_test.rb +201 -35
  99. data/test/action_controller/serialization_test.rb +39 -7
  100. data/test/active_model_serializers/adapter_for_test.rb +208 -0
  101. data/test/active_model_serializers/cached_serializer_test.rb +80 -0
  102. data/test/active_model_serializers/fragment_cache_test.rb +34 -0
  103. data/test/active_model_serializers/json_pointer_test.rb +20 -0
  104. data/test/active_model_serializers/key_transform_test.rb +263 -0
  105. data/test/active_model_serializers/logging_test.rb +8 -8
  106. data/test/active_model_serializers/railtie_test_isolated.rb +6 -0
  107. data/test/active_model_serializers/serialization_context_test_isolated.rb +58 -0
  108. data/test/adapter/deprecation_test.rb +100 -0
  109. data/test/adapter/json/belongs_to_test.rb +32 -34
  110. data/test/adapter/json/collection_test.rb +73 -75
  111. data/test/adapter/json/has_many_test.rb +36 -38
  112. data/test/adapter/json/transform_test.rb +93 -0
  113. data/test/adapter/json_api/belongs_to_test.rb +127 -129
  114. data/test/adapter/json_api/collection_test.rb +80 -82
  115. data/test/adapter/json_api/errors_test.rb +78 -0
  116. data/test/adapter/json_api/fields_test.rb +68 -70
  117. data/test/adapter/json_api/has_many_embed_ids_test.rb +32 -34
  118. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +75 -77
  119. data/test/adapter/json_api/has_many_test.rb +121 -123
  120. data/test/adapter/json_api/has_one_test.rb +59 -61
  121. data/test/adapter/json_api/json_api_test.rb +28 -30
  122. data/test/adapter/json_api/linked_test.rb +319 -321
  123. data/test/adapter/json_api/links_test.rb +75 -50
  124. data/test/adapter/json_api/pagination_links_test.rb +115 -82
  125. data/test/adapter/json_api/parse_test.rb +114 -116
  126. data/test/adapter/json_api/relationship_test.rb +161 -0
  127. data/test/adapter/json_api/relationships_test.rb +199 -0
  128. data/test/adapter/json_api/resource_identifier_test.rb +85 -0
  129. data/test/adapter/json_api/resource_meta_test.rb +100 -0
  130. data/test/adapter/json_api/toplevel_jsonapi_test.rb +61 -63
  131. data/test/adapter/json_api/transform_test.rb +500 -0
  132. data/test/adapter/json_api/type_test.rb +61 -0
  133. data/test/adapter/json_test.rb +35 -37
  134. data/test/adapter/null_test.rb +13 -15
  135. data/test/adapter/polymorphic_test.rb +72 -0
  136. data/test/adapter_test.rb +27 -29
  137. data/test/array_serializer_test.rb +7 -8
  138. data/test/benchmark/app.rb +65 -0
  139. data/test/benchmark/benchmarking_support.rb +67 -0
  140. data/test/benchmark/bm_caching.rb +117 -0
  141. data/test/benchmark/bm_transform.rb +34 -0
  142. data/test/benchmark/config.ru +3 -0
  143. data/test/benchmark/controllers.rb +77 -0
  144. data/test/benchmark/fixtures.rb +167 -0
  145. data/test/cache_test.rb +388 -0
  146. data/test/collection_serializer_test.rb +10 -0
  147. data/test/fixtures/active_record.rb +12 -0
  148. data/test/fixtures/poro.rb +28 -3
  149. data/test/grape_test.rb +5 -5
  150. data/test/lint_test.rb +9 -0
  151. data/test/serializable_resource_test.rb +59 -3
  152. data/test/serializers/associations_test.rb +8 -8
  153. data/test/serializers/attribute_test.rb +7 -7
  154. data/test/serializers/caching_configuration_test_isolated.rb +170 -0
  155. data/test/serializers/meta_test.rb +74 -6
  156. data/test/serializers/read_attribute_for_serialization_test.rb +79 -0
  157. data/test/serializers/serialization_test.rb +55 -0
  158. data/test/support/isolated_unit.rb +3 -0
  159. data/test/support/rails5_shims.rb +26 -8
  160. data/test/support/rails_app.rb +38 -18
  161. data/test/support/serialization_testing.rb +5 -5
  162. data/test/test_helper.rb +6 -10
  163. metadata +132 -37
  164. data/docs/DESIGN.textile +7 -1
  165. data/lib/active_model/serializer/adapter/cached_serializer.rb +0 -45
  166. data/lib/active_model/serializer/adapter/fragment_cache.rb +0 -111
  167. data/lib/active_model/serializer/adapter/json/fragment_cache.rb +0 -13
  168. data/lib/active_model/serializer/adapter/json_api/deserialization.rb +0 -207
  169. data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +0 -21
  170. data/lib/active_model/serializer/adapter/json_api/link.rb +0 -44
  171. data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +0 -58
  172. data/test/active_model_serializers/serialization_context_test.rb +0 -18
  173. data/test/adapter/fragment_cache_test.rb +0 -38
  174. data/test/adapter/json_api/resource_type_config_test.rb +0 -71
  175. data/test/serializers/adapter_for_test.rb +0 -166
  176. data/test/serializers/cache_test.rb +0 -209
  177. data/test/support/simplecov.rb +0 -6
  178. data/test/support/stream_capture.rb +0 -50
  179. data/test/support/test_case.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a84e967d6d485d49bae001e8937b44c77ea0100
4
- data.tar.gz: 707f685e66fdd3e54ee76944d7594e272eaf2920
3
+ metadata.gz: 79d558ff503a5d3d80c7e28d07fbad6858c87416
4
+ data.tar.gz: e1345a0b533ac95996f62e873366907377f8e175
5
5
  SHA512:
6
- metadata.gz: 090a01fff8f35b0e858f31a271f34c53f0d87bd82f1f5ead1e0515d38ee8447a0ba9d2f38abc0dfcf188efe59fdfc4d2057d28296dfe8a5e4abd6464c7dff635
7
- data.tar.gz: 34095f697906ad34ca02913a5619a787d82382baf9b1a60cf9ed43fc74e9939aee8f1391c61dc4a16c60fcdcd009b1479bc407ed6b1c304c54f7081f01f67fc2
6
+ metadata.gz: ded6c2f6e8a7bbe81543a4939ae02c255908697a3894556bc81b5c46cb21b81cf771370fc60a902d393391b0b3addd9a5018cf142a04ecf3752c2aa1dcab2292
7
+ data.tar.gz: 285de3be1603f3ad013da4813ff3a95528e99bf3b2b4f511e780cefb6babd8d9555b113a3eaca762400e64e941d2fc699de02a73745ff56d7365b9dc6c41957a
@@ -0,0 +1,29 @@
1
+ #### Expected behavior vs actual behavior
2
+
3
+
4
+
5
+ #### Steps to reproduce
6
+ *(e.g., detailed walkthrough, runnable script, example application)*
7
+
8
+
9
+
10
+ #### Environment
11
+
12
+ ActiveModelSerializers Version *(commit ref if not on tag)*:
13
+
14
+ Output of `ruby -e "puts RUBY_DESCRIPTION"`:
15
+
16
+ OS Type & Version:
17
+
18
+ Integrated application and version *(e.g., Rails, Grape, etc)*:
19
+
20
+
21
+ #### Backtrace
22
+ *(e.g., provide any applicable backtraces from your application)*
23
+
24
+
25
+
26
+ #### Additonal helpful information
27
+ *(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)*
28
+
29
+
@@ -0,0 +1,15 @@
1
+ #### Purpose
2
+
3
+
4
+ #### Changes
5
+
6
+
7
+ #### Caveats
8
+
9
+
10
+ #### Related GitHub issues
11
+
12
+
13
+ #### Additional helpful information
14
+
15
+
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ tmp
22
22
  .ruby-version
23
23
  .ruby-gemset
24
24
  vendor/bundle
25
+ tags
@@ -1,18 +1,24 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
+ TargetRubyVersion: 2.2
4
5
  Exclude:
5
6
  - config/initializers/forbidden_yaml.rb
6
7
  - !ruby/regexp /(vendor|bundle|bin|db|tmp)\/.*/
7
- RunRailsCops: true
8
8
  DisplayCopNames: true
9
9
  DisplayStyleGuide: true
10
10
 
11
+ Rails:
12
+ Enabled: true
13
+
11
14
  Lint/NestedMethodDefinition:
12
15
  Enabled: false
13
16
  Exclude:
14
17
  - test/action_controller/serialization_test.rb
15
18
 
19
+ Style/Alias:
20
+ EnforcedStyle: prefer_alias
21
+
16
22
  Style/StringLiterals:
17
23
  EnforcedStyle: single_quotes
18
24
 
@@ -59,6 +65,18 @@ Style/BlockDelimiters:
59
65
  Enabled: true
60
66
  EnforcedStyle: line_count_based
61
67
 
68
+ Style/SignalException:
69
+ EnforcedStyle: semantic
70
+
71
+ Style/TrailingCommaInLiteral:
72
+ EnforcedStyleForMultiline: no_comma
73
+
74
+ Style/ConditionalAssignment:
75
+ Enabled: false
76
+
77
+ Style/DotPosition:
78
+ EnforcedStyle: leading
79
+
62
80
  ########## test_helper.rb sanity
63
81
  Style/EndBlock:
64
82
  Exclude:
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-09-20 17:56:22 -0500 using RuboCop version 0.34.0.
3
+ # on 2016-03-08 22:29:52 +0100 using RuboCop version 0.37.2.
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
@@ -13,49 +13,31 @@ Lint/HandleExceptions:
13
13
 
14
14
  # Offense count: 2
15
15
  # Cop supports --auto-correct.
16
- Lint/UnusedBlockArgument:
17
- Exclude:
18
- - 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
19
-
20
- # Offense count: 7
21
- # Cop supports --auto-correct.
16
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
22
17
  Lint/UnusedMethodArgument:
23
18
  Exclude:
24
- - 'lib/active_model/serializer/adapter/null.rb'
25
- - 'lib/active_model/serializer/pass_through_serializer.rb'
26
- - 'test/fixtures/poro.rb'
27
19
  - 'test/lint_test.rb'
28
20
 
29
- # Offense count: 2
30
- Lint/UselessAssignment:
31
- Exclude:
32
- - 'bench/perf.rb'
33
- - 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
34
-
35
- # Offense count: 1
36
- # Configuration parameters: EnforcedStyle, SupportedStyles.
37
- Rails/Date:
38
- Exclude:
39
- - 'test/fixtures/poro.rb'
40
-
41
21
  # Offense count: 4
42
22
  # Configuration parameters: EnforcedStyle, SupportedStyles.
23
+ # SupportedStyles: strict, flexible
43
24
  Rails/TimeZone:
44
25
  Exclude:
45
26
  - 'test/action_controller/serialization_test.rb'
46
- - 'test/fixtures/poro.rb'
47
27
  - 'test/serializers/cache_test.rb'
48
28
 
49
29
  # Offense count: 16
50
30
  # Cop supports --auto-correct.
51
31
  # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
32
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
52
33
  Style/AlignHash:
53
34
  Exclude:
54
35
  - 'test/action_controller/json_api/pagination_test.rb'
55
36
 
56
- # Offense count: 25
37
+ # Offense count: 27
57
38
  # Cop supports --auto-correct.
58
39
  # Configuration parameters: EnforcedStyle, SupportedStyles.
40
+ # SupportedStyles: braces, no_braces, context_dependent
59
41
  Style/BracesAroundHashParameters:
60
42
  Exclude:
61
43
  - 'test/action_controller/adapter_selector_test.rb'
@@ -67,17 +49,16 @@ Style/BracesAroundHashParameters:
67
49
  - 'test/collection_serializer_test.rb'
68
50
  - 'test/serializable_resource_test.rb'
69
51
  - 'test/serializers/associations_test.rb'
70
- - 'test/serializers/attribute_test.rb'
71
52
  - 'test/serializers/attributes_test.rb'
72
- - 'test/serializers/fieldset_test.rb'
73
53
  - 'test/serializers/root_test.rb'
74
54
 
75
- # Offense count: 174
55
+ # Offense count: 271
76
56
  # Configuration parameters: EnforcedStyle, SupportedStyles.
57
+ # SupportedStyles: nested, compact
77
58
  Style/ClassAndModuleChildren:
78
59
  Enabled: false
79
60
 
80
- # Offense count: 5
61
+ # Offense count: 6
81
62
  # Cop supports --auto-correct.
82
63
  Style/CommentIndentation:
83
64
  Exclude:
@@ -89,34 +70,29 @@ Style/DoubleNegation:
89
70
  - 'lib/active_model/serializable_resource.rb'
90
71
 
91
72
  # Offense count: 1
92
- Style/EachWithObject:
93
- Exclude:
94
- - 'lib/active_model/serializer/fieldset.rb'
95
-
96
- # Offense count: 2
97
73
  # Configuration parameters: MinBodyLength.
98
74
  Style/GuardClause:
99
75
  Exclude:
100
76
  - 'lib/active_model/serializer.rb'
101
77
 
102
- # Offense count: 12
78
+ # Offense count: 58
103
79
  # Cop supports --auto-correct.
104
80
  # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
81
+ # SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
105
82
  Style/HashSyntax:
106
83
  Enabled: false
107
84
 
108
- # Offense count: 9
85
+ # Offense count: 4
109
86
  # Cop supports --auto-correct.
87
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
88
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
110
89
  Style/IndentArray:
111
- Exclude:
112
- - 'test/adapter/json/has_many_test.rb'
113
- - 'test/adapter/json_api/json_api_test.rb'
114
- - 'test/adapter/json_api/pagination_links_test.rb'
115
- - 'test/adapter/json_test.rb'
90
+ Enabled: false
116
91
 
117
- # Offense count: 8
92
+ # Offense count: 10
118
93
  # Cop supports --auto-correct.
119
- # Configuration parameters: EnforcedStyle, SupportedStyles.
94
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
95
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
120
96
  Style/IndentHash:
121
97
  Enabled: false
122
98
 
@@ -129,12 +105,14 @@ Style/Lambda:
129
105
  # Offense count: 1
130
106
  # Cop supports --auto-correct.
131
107
  # Configuration parameters: EnforcedStyle, SupportedStyles.
108
+ # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
132
109
  Style/MethodDefParentheses:
133
110
  Enabled: false
134
111
 
135
- # Offense count: 3
112
+ # Offense count: 1
136
113
  # Cop supports --auto-correct.
137
- # Configuration parameters: EnforcedStyle, SupportedStyles.
114
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
115
+ # SupportedStyles: aligned, indented
138
116
  Style/MultilineOperationIndentation:
139
117
  Enabled: false
140
118
 
@@ -146,45 +124,26 @@ Style/NegatedIf:
146
124
 
147
125
  # Offense count: 1
148
126
  # Cop supports --auto-correct.
149
- Style/NumericLiterals:
150
- MinDigits: 7
151
-
152
- # Offense count: 2
153
- # Cop supports --auto-correct.
154
127
  Style/PerlBackrefs:
155
128
  Exclude:
156
129
  - 'test/fixtures/poro.rb'
157
- - 'test/serializers/associations_test.rb'
158
130
 
159
131
  # Offense count: 3
160
- # Configuration parameters: NamePrefix, NamePrefixBlacklist.
132
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
133
+ # NamePrefix: is_, has_, have_
134
+ # NamePrefixBlacklist: is_, has_, have_
135
+ # NameWhitelist: is_a?
161
136
  Style/PredicateName:
162
137
  Exclude:
163
138
  - 'lib/active_model/serializer/associations.rb'
164
139
  - 'test/action_controller/json_api/linked_test.rb'
165
140
 
166
- # Offense count: 5
141
+ # Offense count: 1
167
142
  # Cop supports --auto-correct.
168
143
  Style/RedundantSelf:
169
144
  Exclude:
170
- - 'lib/active_model/serializer/associations.rb'
171
145
  - 'test/fixtures/poro.rb'
172
146
 
173
- # Offense count: 1
174
- # Cop supports --auto-correct.
175
- # Configuration parameters: AllowAsExpressionSeparator.
176
- Style/Semicolon:
177
- Exclude:
178
- - 'lib/active_model/serializer/fieldset.rb'
179
-
180
- # Offense count: 3
181
- # Cop supports --auto-correct.
182
- # Configuration parameters: EnforcedStyle, SupportedStyles.
183
- Style/SignalException:
184
- Exclude:
185
- - 'lib/active_model/serializer/fieldset.rb'
186
- - 'lib/active_model/serializer/pass_through_serializer.rb'
187
-
188
147
  # Offense count: 1
189
148
  # Cop supports --auto-correct.
190
149
  # Configuration parameters: AllowIfMethodIsEmpty.
@@ -192,49 +151,17 @@ Style/SingleLineMethods:
192
151
  Exclude:
193
152
  - 'test/serializers/serializer_for_test.rb'
194
153
 
195
- # Offense count: 2
154
+ # Offense count: 4
196
155
  # Cop supports --auto-correct.
197
156
  # Configuration parameters: EnforcedStyle, SupportedStyles.
157
+ # SupportedStyles: single_quotes, double_quotes
198
158
  Style/StringLiteralsInInterpolation:
199
159
  Enabled: false
200
160
 
201
- # Offense count: 1
202
- Style/StructInheritance:
203
- Exclude:
204
- - 'bench/perf.rb'
205
-
206
161
  # Offense count: 1
207
162
  # Cop supports --auto-correct.
208
- # Configuration parameters: IgnoredMethods.
209
- Style/SymbolProc:
210
- Exclude:
211
- - 'lib/generators/serializer/serializer_generator.rb'
212
-
213
- # Offense count: 8
214
- # Cop supports --auto-correct.
215
163
  # Configuration parameters: EnforcedStyle, SupportedStyles.
164
+ # SupportedStyles: final_newline, final_blank_line
216
165
  Style/TrailingBlankLines:
217
166
  Exclude:
218
- - 'lib/active_model/serializer/pass_through_serializer.rb'
219
- - 'lib/generators/serializer/serializer_generator.rb'
220
- - 'test/adapter/fragment_cache_test.rb'
221
- - 'test/adapter/json_api/json_api_test.rb'
222
167
  - 'test/adapter/null_test.rb'
223
- - 'test/serializers/cache_test.rb'
224
- - 'test/serializers/fieldset_test.rb'
225
- - 'test/support/stream_capture.rb'
226
-
227
- # Offense count: 5
228
- # Cop supports --auto-correct.
229
- # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
230
- Style/TrailingComma:
231
- Exclude:
232
- - 'test/action_controller/adapter_selector_test.rb'
233
- - 'test/action_controller/serialization_test.rb'
234
- - 'test/adapter/json_api/belongs_to_test.rb'
235
- - 'test/adapter/json_api/linked_test.rb'
236
-
237
- # Offense count: 1
238
- Style/UnlessElse:
239
- Exclude:
240
- - 'lib/active_model/serializer.rb'
data/.simplecov CHANGED
@@ -19,7 +19,6 @@ ENV['FULL_BUILD'] ||= ENV['CI']
19
19
  # rubocop:enable Style/DoubleNegation
20
20
 
21
21
  ## CONFIGURE SIMPLECOV
22
- SimpleCov.pid = $$ # In case there's any forking
23
22
 
24
23
  SimpleCov.profiles.define 'app' do
25
24
  coverage_dir 'coverage'
@@ -8,7 +8,11 @@ rvm:
8
8
  - 2.2.3
9
9
  - 2.3.0
10
10
  - ruby-head
11
- - rbx-2
11
+ - jruby-9.0.4.0
12
+ - jruby-head
13
+
14
+ jdk:
15
+ - oraclejdk8
12
16
 
13
17
  install: bundle install --path=vendor/bundle --retry=3 --jobs=3
14
18
  cache:
@@ -19,10 +23,13 @@ script:
19
23
  - bundle exec rake ci
20
24
 
21
25
  env:
22
- - "RAILS_VERSION=4.0"
23
- - "RAILS_VERSION=4.1"
24
- - "RAILS_VERSION=4.2"
25
- - "RAILS_VERSION=master"
26
+ global:
27
+ - "JRUBY_OPTS='--dev -J-Xmx1024M --debug'"
28
+ matrix:
29
+ - "RAILS_VERSION=4.0"
30
+ - "RAILS_VERSION=4.1"
31
+ - "RAILS_VERSION=4.2"
32
+ - "RAILS_VERSION=master"
26
33
 
27
34
  matrix:
28
35
  exclude:
@@ -30,10 +37,15 @@ matrix:
30
37
  env: RAILS_VERSION=master
31
38
  - rvm: 2.1
32
39
  env: RAILS_VERSION=master
33
- include:
34
40
  - rvm: jruby-9.0.4.0
35
- env: JRUBY_OPTS='-Xcompat.version=2.0 --server -Xcompile.invokedynamic=false -Xcli.debug=true --debug'
41
+ env: RAILS_VERSION=master
42
+ - rvm: jruby-9.0.4.0
43
+ env: RAILS_VERSION=4.0
44
+ - rvm: jruby-head
45
+ env: RAILS_VERSION=master
46
+ - rvm: jruby-head
47
+ env: RAILS_VERSION=4.0
36
48
  allow_failures:
37
49
  - rvm: ruby-head
38
- - rvm: rbx-2
50
+ - rvm: jruby-head
39
51
  fast_finish: true
@@ -1,7 +1,89 @@
1
1
  ## 0.10.x
2
2
 
3
+ ### [v0.10.0.rc5 (2016-04-04)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc4...v0.10.0.rc5)
3
4
 
4
- ### v0.10.0.rc4 (2016/01/27 11:00 +00:00)
5
+ Breaking changes:
6
+
7
+ - [#1645](https://github.com/rails-api/active_model_serializers/pull/1645) Changed :dashed key transform to :dash. (@remear)
8
+ - [#1574](https://github.com/rails-api/active_model_serializers/pull/1574) Default key case for the JsonApi adapter changed to dashed. (@remear)
9
+
10
+ Features:
11
+ - [#1645](https://github.com/rails-api/active_model_serializers/pull/1645) Transform keys referenced in values. (@remear)
12
+ - [#1650](https://github.com/rails-api/active_model_serializers/pull/1650) Fix serialization scope options `scope`, `scope_name`
13
+ take precedence over `serialization_scope` in the controller.
14
+ Fix tests that required tearing down dynamic methods. (@bf4)
15
+ - [#1644](https://github.com/rails-api/active_model_serializers/pull/1644) Include adapter name in cache key so
16
+ that the same serializer can be cached per adapter. (@bf4 via #1346 by @kevintyll)
17
+ - [#1642](https://github.com/rails-api/active_model_serializers/pull/1642) Prefer object.cache_key over the generated
18
+ cache key. (@bf4 via #1346 by @kevintyll)
19
+ - [#1637](https://github.com/rails-api/active_model_serializers/pull/1637) Make references to 'ActionController::Base.cache_store' explicit
20
+ in order to avoid issues when application controllers inherit from 'ActionController::API'. (@ncuesta)
21
+ - [#1633](https://github.com/rails-api/active_model_serializers/pull/1633) Yield 'serializer' to serializer association blocks. (@bf4)
22
+ - [#1616](https://github.com/rails-api/active_model_serializers/pull/1616) SerializableResource handles no serializer like controller. (@bf4)
23
+ - [#1618](https://github.com/rails-api/active_model_serializers/issues/1618) Get collection root key for
24
+ empty collection from explicit serializer option, when possible. (@bf4)
25
+ - [#1574](https://github.com/rails-api/active_model_serializers/pull/1574) Provide key translation. (@remear)
26
+ - [#1494](https://github.com/rails-api/active_model_serializers/pull/1494) Make serializers serializalbe
27
+ (using the Attributes adapter by default). (@bf4)
28
+ - [#1550](https://github.com/rails-api/active_model_serializers/pull/1550) Add
29
+ Rails url_helpers to `SerializationContext` for use in links. (@remear, @bf4)
30
+ - [#1004](https://github.com/rails-api/active_model_serializers/pull/1004) JSON API errors object implementation.
31
+ - Only implements `detail` and `source` as derived from `ActiveModel::Error`
32
+ - Provides checklist of remaining questions and remaining parts of the spec.
33
+ - [#1515](https://github.com/rails-api/active_model_serializers/pull/1515) Adds support for symbols to the
34
+ `ActiveModel::Serializer.type` method. (@groyoh)
35
+ - [#1504](https://github.com/rails-api/active_model_serializers/pull/1504) Adds the changes missing from #1454
36
+ and add more tests for resource identifier and relationship objects. Fix association block with link
37
+ returning `data: nil`.(@groyoh)
38
+ - [#1372](https://github.com/rails-api/active_model_serializers/pull/1372) Support
39
+ cache_store.read_multi. (@LcpMarvel)
40
+ - [#1018](https://github.com/rails-api/active_model_serializers/pull/1018) Add more tests and docs for top-level links. (@leandrocp)
41
+ - [#1454](https://github.com/rails-api/active_model_serializers/pull/1454) Add support for
42
+ relationship-level links and meta attributes. (@beauby)
43
+ - [#1340](https://github.com/rails-api/active_model_serializers/pull/1340) Add support for resource-level meta. (@beauby)
44
+
45
+ Fixes:
46
+ - [#1657](https://github.com/rails-api/active_model_serializers/pull/1657) Add missing missing require "active_support/json". (@andreaseger)
47
+ - [#1661](https://github.com/rails-api/active_model_serializers/pull/1661) Fixes `read_attribute_for_serialization` not
48
+ seeing methods defined in serialization superclass (#1653, #1658, #1660), introduced in #1650. (@bf4)
49
+ - [#1651](https://github.com/rails-api/active_model_serializers/pull/1651) Fix deserialization of nil relationships. (@NullVoxPopuli)
50
+ - [#1480](https://github.com/rails-api/active_model_serializers/pull/1480) Fix setting of cache_store from Rails configuration. (@bf4)
51
+ Fix unintentional mutating of value in memory cache store. (@groyoh)
52
+ - [#1622](https://github.com/rails-api/active_model_serializers/pull/1622) Fragment cache changed from per-record to per-serializer.
53
+ Now, two serializers that use the same model may be separately cached. (@lserman)
54
+ - [#1478](https://github.com/rails-api/active_model_serializers/pull/1478) Cache store will now be correctly set when serializers are
55
+ loaded *before* Rails initializes. (@bf4)
56
+ - [#1570](https://github.com/rails-api/active_model_serializers/pull/1570) Fixed pagination issue with last page size. (@bmorrall)
57
+ - [#1516](https://github.com/rails-api/active_model_serializers/pull/1516) No longer return a nil href when only
58
+ adding meta to a relationship link. (@groyoh)
59
+ - [#1458](https://github.com/rails-api/active_model_serializers/pull/1458) Preserve the serializer
60
+ type when fragment caching. (@bdmac)
61
+ - [#1477](https://github.com/rails-api/active_model_serializers/pull/1477) Fix `fragment_cached?`
62
+ method to check if caching. (@bdmac)
63
+ - [#1501](https://github.com/rails-api/active_model_serializers/pull/1501) Adds tests for SerializableResource::use_adapter?,doc typos (@domitian)
64
+ - [#1488](https://github.com/rails-api/active_model_serializers/pull/1488) Require ActiveSupport's string inflections (@nate00)
65
+
66
+ Misc:
67
+ - [#1608](https://github.com/rails-api/active_model_serializers/pull/1608) Move SerializableResource to ActiveModelSerializers (@groyoh)
68
+ - [#1602](https://github.com/rails-api/active_model_serializers/pull/1602) Add output examples to Adapters docs (@remear)
69
+ - [#1557](https://github.com/rails-api/active_model_serializers/pull/1557) Update docs regarding overriding the root key (@Jwan622)
70
+ - [#1471](https://github.com/rails-api/active_model_serializers/pull/1471) [Cleanup] Serializer caching is its own concern. (@bf4)
71
+ - [#1482](https://github.com/rails-api/active_model_serializers/pull/1482) Document JSON API implementation defs and progress in class. (@bf4)
72
+ - [#1551](https://github.com/rails-api/active_model_serializers/pull/1551) Added codebeat badge (@korzonek)
73
+ - [#1527](https://github.com/rails-api/active_model_serializers/pull/1527) Refactor fragment cache class. (@groyoh)
74
+ - [#1560](https://github.com/rails-api/active_model_serializers/pull/1560) Update rubocop and address its warnings. (@bf4 @groyoh)
75
+ - [#1545](https://github.com/rails-api/active_model_serializers/pull/1545) Document how to pass arbitrary options to the
76
+ serializer (@CodedBeardedSignedTaylor)
77
+ - [#1496](https://github.com/rails-api/active_model_serializers/pull/1496) Run all branches against JRuby on CI (@nadavshatz)
78
+ - [#1559](https://github.com/rails-api/active_model_serializers/pull/1559) Add a deprecation DSL. (@bf4 @groyoh)
79
+ - [#1543](https://github.com/rails-api/active_model_serializers/pull/1543) Add the changes missing from #1535. (@groyoh)
80
+ - [#1535](https://github.com/rails-api/active_model_serializers/pull/1535) Move the adapter and adapter folder to
81
+ active_model_serializers folder and changes the module namespace. (@domitian @bf4)
82
+ - [#1497](https://github.com/rails-api/active_model_serializers/pull/1497) Add JRuby-9000 to appveyor.yml(@corainchicago)
83
+ - [#1420](https://github.com/rails-api/active_model_serializers/pull/1420) Adds tests and documentation for polymorphism(@marcgarreau)
84
+
85
+
86
+ ### [v0.10.0.rc4 (2016-01-27)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc3...v0.10.0.rc4)
5
87
  Breaking changes:
6
88
 
7
89
  - [#1360](https://github.com/rails-api/active_model_serializers/pull/1360)
@@ -96,7 +178,7 @@ Misc:
96
178
  - [#1360](https://github.com/rails-api/active_model_serializers/pull/1360) Update CI to test 2.2.2 -> 2.2.3 (@karaAJC)
97
179
  - [#1371](https://github.com/rails-api/active_model_serializers/pull/1371) Refactor, update, create documentation (@bf4)
98
180
 
99
- ### v0.10.0.rc3 (2015/09/16 15:19 +00:00)
181
+ ### [v0.10.0.rc3 (2015-09-16)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc2...v0.10.0.rc3)
100
182
  - [#1129](https://github.com/rails-api/active_model_serializers/pull/1129) Remove SerializableResource.serialize in favor of `.new` (@bf4)
101
183
  - [#1155](https://github.com/rails-api/active_model_serializers/pull/1155) Outside controller use tutorial (@CodedBeardedSignedTaylor)
102
184
  - [#1154](https://github.com/rails-api/active_model_serializers/pull/1154) Rubocop fixes for issues introduced by #1089 (@NullVoxPopuli)
@@ -171,7 +253,7 @@ Misc:
171
253
  - [#965](https://github.com/rails-api/active_model_serializers/pull/965) options fedault valueserializable_hash and as_json (@bf4)
172
254
  - [#959](https://github.com/rails-api/active_model_serializers/pull/959) TYPO on README.md (@kangkyu)
173
255
 
174
- ### v0.10.0.rc2 (2015/06/16 21:30 +00:00)
256
+ ### [v0.10.0.rc2 (2015-06-16)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc1...v0.10.0.rc2)
175
257
  - [#958](https://github.com/rails-api/active_model_serializers/pull/958) Splitting json adapter into two (@joaomdmoura)
176
258
  * adds FlattenJSON as default adapter
177
259
  - [#953](https://github.com/rails-api/active_model_serializers/pull/953) use model name to determine the type (@lsylvester)
@@ -200,7 +282,7 @@ Misc:
200
282
  - [#887](https://github.com/rails-api/active_model_serializers/pull/887) Fixing tests on JRuby (@joaomdmoura)
201
283
  - [#885](https://github.com/rails-api/active_model_serializers/pull/885) Updates rails versions for test and dev (@tonyta)
202
284
 
203
- ### v0.10.0.rc1 (2015/04/22 06:06 +00:00)
285
+ ### [v0.10.0.rc1 (2015-04-22)](https://github.com/rails-api/active_model_serializers/compare/86fc7d7227f3ce538fcb28c1e8c7069ce311f0e1...v0.10.0.rc1)
204
286
  - [#810](https://github.com/rails-api/active_model_serializers/pull/810) Adding Fragment Cache to AMS (@joaomdmoura)
205
287
  * adds fragment cache support
206
288
  - [#868](https://github.com/rails-api/active_model_serializers/pull/868) Fixed a bug that appears when a nil association is included (@groyoh)
@@ -309,6 +391,8 @@ Features:
309
391
 
310
392
  * Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
311
393
 
394
+ * [Beginning of rewrite: c65d387705ec534db171712671ba7fcda4f49f68](https://github.com/rails-api/active_model_serializers/commit/c65d387705ec534db171712671ba7fcda4f49f68)
395
+
312
396
  ## 0.08.x
313
397
 
314
398
  ### v0.8.3 (2014/12/10 14:45 +00:00)
@@ -410,7 +494,7 @@ Features:
410
494
  '[Revert the serializers API as other alternatives are now also under discussion](https://github.com/rails/rails/commit/0a4035b12a6c59253cb60f9e3456513c6a6a9d33)'.
411
495
  - [Proposed Implementation to Rails 3.2 by @wycats and @josevalim (November 25, 2011)](https://github.com/rails/rails/pull/3753)
412
496
  - [Creation of `ActionController::Serialization`, initial serializer
413
- support (September, 26 2011)](https://github.com/rails/rails/commit/8ff7693a8dc61f43fc4eaf72ed24d3b8699191fe0).
497
+ support (September, 26 2011)](https://github.com/rails/rails/commit/8ff7693a8dc61f43fc4eaf72ed24d3b8699191fe).
414
498
  - [Docs and CHANGELOG](https://github.com/rails/rails/commit/696d01f7f4a8ed787924a41cce6df836cd73c46f)
415
499
  - [Deprecation of ActiveModel::Serialization to ActiveModel::Serializable](https://github.com/rails/rails/blob/696d01f7f4a8ed787924a41cce6df836cd73c46f/activemodel/lib/active_model/serialization.rb)
416
500
  - [Creation of `ActiveModel::Serialization` from `ActiveModel::Serializer` in Rails (2009)](https://github.com/rails/rails/commit/c6bc8e662614be711f45a8d4b231d5f993b024a7#diff-d029b9768d8df0407a35804a468e3ae5)