active_model_serializers 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -1
  3. data/CHANGELOG.md +45 -3
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +4 -1
  6. data/README.md +5 -2
  7. data/active_model_serializers.gemspec +2 -2
  8. data/docs/ARCHITECTURE.md +6 -7
  9. data/docs/README.md +2 -0
  10. data/docs/general/caching.md +7 -1
  11. data/docs/general/configuration_options.md +64 -0
  12. data/docs/general/rendering.md +35 -1
  13. data/docs/general/serializers.md +35 -5
  14. data/docs/howto/add_pagination_links.md +2 -2
  15. data/docs/howto/add_relationship_links.md +137 -0
  16. data/docs/howto/add_root_key.md +4 -0
  17. data/docs/howto/grape_integration.md +42 -0
  18. data/docs/howto/outside_controller_use.md +9 -2
  19. data/docs/howto/passing_arbitrary_options.md +2 -2
  20. data/docs/howto/test.md +2 -0
  21. data/docs/howto/upgrade_from_0_8_to_0_10.md +265 -0
  22. data/docs/integrations/ember-and-json-api.md +41 -24
  23. data/lib/action_controller/serialization.rb +9 -0
  24. data/lib/active_model/serializer.rb +19 -22
  25. data/lib/active_model/serializer/association.rb +19 -4
  26. data/lib/active_model/serializer/collection_serializer.rb +8 -5
  27. data/lib/active_model/serializer/{associations.rb → concerns/associations.rb} +8 -5
  28. data/lib/active_model/serializer/{attributes.rb → concerns/attributes.rb} +0 -0
  29. data/lib/active_model/serializer/{caching.rb → concerns/caching.rb} +5 -1
  30. data/lib/active_model/serializer/{configuration.rb → concerns/configuration.rb} +24 -1
  31. data/lib/active_model/serializer/{links.rb → concerns/links.rb} +0 -0
  32. data/lib/active_model/serializer/{meta.rb → concerns/meta.rb} +0 -0
  33. data/lib/active_model/serializer/{type.rb → concerns/type.rb} +0 -0
  34. data/lib/active_model/serializer/reflection.rb +37 -21
  35. data/lib/active_model/serializer/version.rb +1 -1
  36. data/lib/active_model_serializers.rb +1 -0
  37. data/lib/active_model_serializers/adapter/attributes.rb +3 -1
  38. data/lib/active_model_serializers/adapter/json_api.rb +15 -22
  39. data/lib/active_model_serializers/adapter/json_api/relationship.rb +30 -19
  40. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +23 -9
  41. data/lib/active_model_serializers/key_transform.rb +4 -0
  42. data/lib/active_model_serializers/lookup_chain.rb +80 -0
  43. data/lib/active_model_serializers/model.rb +1 -1
  44. data/lib/active_model_serializers/serializable_resource.rb +6 -5
  45. data/lib/generators/rails/serializer_generator.rb +1 -1
  46. data/test/action_controller/json_api/fields_test.rb +57 -0
  47. data/test/action_controller/json_api/transform_test.rb +3 -3
  48. data/test/action_controller/lookup_proc_test.rb +49 -0
  49. data/test/action_controller/namespace_lookup_test.rb +226 -0
  50. data/test/active_model_serializers/key_transform_test.rb +32 -0
  51. data/test/active_model_serializers/model_test.rb +11 -0
  52. data/test/adapter/attributes_test.rb +43 -0
  53. data/test/adapter/json/transform_test.rb +1 -1
  54. data/test/adapter/json_api/fields_test.rb +4 -3
  55. data/test/adapter/json_api/has_many_test.rb +21 -0
  56. data/test/adapter/json_api/include_data_if_sideloaded_test.rb +166 -0
  57. data/test/adapter/json_api/linked_test.rb +24 -6
  58. data/test/adapter/json_api/links_test.rb +1 -1
  59. data/test/adapter/json_api/pagination_links_test.rb +17 -2
  60. data/test/adapter/json_api/relationship_test.rb +309 -73
  61. data/test/adapter/json_api/resource_identifier_test.rb +20 -0
  62. data/test/adapter/json_api/transform_test.rb +4 -3
  63. data/test/benchmark/benchmarking_support.rb +1 -1
  64. data/test/benchmark/bm_active_record.rb +81 -0
  65. data/test/benchmark/bm_adapter.rb +38 -0
  66. data/test/benchmark/bm_caching.rb +1 -1
  67. data/test/benchmark/bm_lookup_chain.rb +83 -0
  68. data/test/cache_test.rb +42 -4
  69. data/test/collection_serializer_test.rb +1 -1
  70. data/test/fixtures/poro.rb +44 -41
  71. data/test/generators/serializer_generator_test.rb +22 -5
  72. data/test/serializers/association_macros_test.rb +3 -2
  73. data/test/serializers/associations_test.rb +97 -22
  74. data/test/serializers/attribute_test.rb +1 -1
  75. data/test/serializers/serializer_for_test.rb +3 -3
  76. data/test/serializers/serializer_for_with_namespace_test.rb +87 -0
  77. data/test/support/serialization_testing.rb +16 -0
  78. data/test/test_helper.rb +1 -0
  79. metadata +35 -14
  80. data/test/adapter/json_api/relationships_test.rb +0 -204
@@ -20,11 +20,10 @@ class SerializerGeneratorTest < Rails::Generators::TestCase
20
20
  end
21
21
 
22
22
  def test_uses_application_serializer_if_one_exists
23
- Object.const_set(:ApplicationSerializer, Class.new)
24
- run_generator
25
- assert_file 'app/serializers/account_serializer.rb', /class AccountSerializer < ApplicationSerializer/
26
- ensure
27
- Object.send :remove_const, :ApplicationSerializer
23
+ stub_safe_constantize(expected: 'ApplicationSerializer') do
24
+ run_generator
25
+ assert_file 'app/serializers/account_serializer.rb', /class AccountSerializer < ApplicationSerializer/
26
+ end
28
27
  end
29
28
 
30
29
  def test_uses_given_parent
@@ -54,4 +53,22 @@ class SerializerGeneratorTest < Rails::Generators::TestCase
54
53
  end
55
54
  end
56
55
  end
56
+
57
+ private
58
+
59
+ def stub_safe_constantize(expected:)
60
+ String.class_eval do
61
+ alias_method :old, :safe_constantize
62
+ end
63
+ String.send(:define_method, :safe_constantize) do
64
+ Class if self == expected
65
+ end
66
+
67
+ yield
68
+ ensure
69
+ String.class_eval do
70
+ alias_method :safe_constantize, :old
71
+ undef_method :old
72
+ end
73
+ end
57
74
  end
@@ -3,7 +3,8 @@ require 'test_helper'
3
3
  module ActiveModel
4
4
  class Serializer
5
5
  class AssociationMacrosTest < ActiveSupport::TestCase
6
- AuthorSummarySerializer = Class.new
6
+ class AuthorSummarySerializer < ActiveModel::Serializer; end
7
+
7
8
  class AssociationsTestSerializer < Serializer
8
9
  belongs_to :author, serializer: AuthorSummarySerializer
9
10
  has_many :comments
@@ -11,7 +12,7 @@ module ActiveModel
11
12
  end
12
13
 
13
14
  def before_setup
14
- @reflections = AssociationsTestSerializer._reflections
15
+ @reflections = AssociationsTestSerializer._reflections.values
15
16
  end
16
17
 
17
18
  def test_has_one_defines_reflection
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
-
3
2
  module ActiveModel
4
3
  class Serializer
5
4
  class AssociationsTest < ActiveSupport::TestCase
@@ -32,13 +31,13 @@ module ActiveModel
32
31
 
33
32
  case key
34
33
  when :posts
35
- assert_equal({ include_data: true }, options)
34
+ assert_equal true, options.fetch(:include_data)
36
35
  assert_kind_of(ActiveModelSerializers.config.collection_serializer, serializer)
37
36
  when :bio
38
- assert_equal({ include_data: true }, options)
37
+ assert_equal true, options.fetch(:include_data)
39
38
  assert_nil serializer
40
39
  when :roles
41
- assert_equal({ include_data: true }, options)
40
+ assert_equal true, options.fetch(:include_data)
42
41
  assert_kind_of(ActiveModelSerializers.config.collection_serializer, serializer)
43
42
  else
44
43
  flunk "Unknown association: #{key}"
@@ -80,7 +79,7 @@ module ActiveModel
80
79
  flunk "Unknown association: #{key}"
81
80
  end
82
81
 
83
- assert_equal({ include_data: true }, association.options)
82
+ assert_equal true, association.options.fetch(:include_data)
84
83
  end
85
84
  end
86
85
 
@@ -104,13 +103,13 @@ module ActiveModel
104
103
  end
105
104
 
106
105
  assert(
107
- PostSerializer._reflections.all? do |reflection|
108
- inherited_klass._reflections.include?(reflection)
106
+ PostSerializer._reflections.values.all? do |reflection|
107
+ inherited_klass._reflections.values.include?(reflection)
109
108
  end
110
109
  )
111
110
 
112
111
  assert(
113
- inherited_klass._reflections.any? do |reflection|
112
+ inherited_klass._reflections.values.any? do |reflection|
114
113
  reflection.name == :top_comments
115
114
  end
116
115
  )
@@ -160,18 +159,18 @@ module ActiveModel
160
159
 
161
160
  class NamespacedResourcesTest < ActiveSupport::TestCase
162
161
  class ResourceNamespace
163
- Post = Class.new(::Model)
164
- Comment = Class.new(::Model)
165
- Author = Class.new(::Model)
166
- Description = Class.new(::Model)
162
+ class Post < ::Model; end
163
+ class Comment < ::Model; end
164
+ class Author < ::Model; end
165
+ class Description < ::Model; end
167
166
  class PostSerializer < ActiveModel::Serializer
168
167
  has_many :comments
169
168
  belongs_to :author
170
169
  has_one :description
171
170
  end
172
- CommentSerializer = Class.new(ActiveModel::Serializer)
173
- AuthorSerializer = Class.new(ActiveModel::Serializer)
174
- DescriptionSerializer = Class.new(ActiveModel::Serializer)
171
+ class CommentSerializer < ActiveModel::Serializer; end
172
+ class AuthorSerializer < ActiveModel::Serializer; end
173
+ class DescriptionSerializer < ActiveModel::Serializer; end
175
174
  end
176
175
 
177
176
  def setup
@@ -201,17 +200,17 @@ module ActiveModel
201
200
  end
202
201
 
203
202
  class NestedSerializersTest < ActiveSupport::TestCase
204
- Post = Class.new(::Model)
205
- Comment = Class.new(::Model)
206
- Author = Class.new(::Model)
207
- Description = Class.new(::Model)
203
+ class Post < ::Model; end
204
+ class Comment < ::Model; end
205
+ class Author < ::Model; end
206
+ class Description < ::Model; end
208
207
  class PostSerializer < ActiveModel::Serializer
209
208
  has_many :comments
210
- CommentSerializer = Class.new(ActiveModel::Serializer)
209
+ class CommentSerializer < ActiveModel::Serializer; end
211
210
  belongs_to :author
212
- AuthorSerializer = Class.new(ActiveModel::Serializer)
211
+ class AuthorSerializer < ActiveModel::Serializer; end
213
212
  has_one :description
214
- DescriptionSerializer = Class.new(ActiveModel::Serializer)
213
+ class DescriptionSerializer < ActiveModel::Serializer; end
215
214
  end
216
215
 
217
216
  def setup
@@ -290,6 +289,82 @@ module ActiveModel
290
289
  assert_match(/:if should be a Symbol, String or Proc/, exception.message)
291
290
  end
292
291
  end
292
+
293
+ class InheritedSerializerTest < ActiveSupport::TestCase
294
+ class PostSerializer < ActiveModel::Serializer
295
+ belongs_to :author
296
+ has_many :comments
297
+ belongs_to :blog
298
+ end
299
+
300
+ class InheritedPostSerializer < PostSerializer
301
+ belongs_to :author, polymorphic: true
302
+ has_many :comments, key: :reviews
303
+ end
304
+
305
+ class AuthorSerializer < ActiveModel::Serializer
306
+ has_many :posts
307
+ has_many :roles
308
+ has_one :bio
309
+ end
310
+
311
+ class InheritedAuthorSerializer < AuthorSerializer
312
+ has_many :roles, polymorphic: true
313
+ has_one :bio, polymorphic: true
314
+ end
315
+
316
+ def setup
317
+ @author = Author.new(name: 'Steve K.')
318
+ @post = Post.new(title: 'New Post', body: 'Body')
319
+ @post_serializer = PostSerializer.new(@post)
320
+ @author_serializer = AuthorSerializer.new(@author)
321
+ @inherited_post_serializer = InheritedPostSerializer.new(@post)
322
+ @inherited_author_serializer = InheritedAuthorSerializer.new(@author)
323
+ @author_associations = @author_serializer.associations.to_a
324
+ @inherited_author_associations = @inherited_author_serializer.associations.to_a
325
+ @post_associations = @post_serializer.associations.to_a
326
+ @inherited_post_associations = @inherited_post_serializer.associations.to_a
327
+ end
328
+
329
+ test 'an author serializer must have [posts,roles,bio] associations' do
330
+ expected = [:posts, :roles, :bio].sort
331
+ result = @author_serializer.associations.map(&:name).sort
332
+ assert_equal(result, expected)
333
+ end
334
+
335
+ test 'a post serializer must have [author,comments,blog] associations' do
336
+ expected = [:author, :comments, :blog].sort
337
+ result = @post_serializer.associations.map(&:name).sort
338
+ assert_equal(result, expected)
339
+ end
340
+
341
+ test 'a serializer inheriting from another serializer can redefine has_many and has_one associations' do
342
+ expected = [:roles, :bio].sort
343
+ result = (@inherited_author_associations - @author_associations).map(&:name).sort
344
+ assert_equal(result, expected)
345
+ end
346
+
347
+ test 'a serializer inheriting from another serializer can redefine belongs_to associations' do
348
+ assert_equal [:author, :comments, :blog], @post_associations.map(&:name)
349
+ assert_equal [:author, :comments, :blog, :comments], @inherited_post_associations.map(&:name)
350
+
351
+ refute @post_associations.detect { |assoc| assoc.name == :author }.options.key?(:polymorphic)
352
+ assert_equal true, @inherited_post_associations.detect { |assoc| assoc.name == :author }.options.fetch(:polymorphic)
353
+
354
+ refute @post_associations.detect { |assoc| assoc.name == :comments }.options.key?(:key)
355
+ original_comment_assoc, new_comments_assoc = @inherited_post_associations.select { |assoc| assoc.name == :comments }
356
+ refute original_comment_assoc.options.key?(:key)
357
+ assert_equal :reviews, new_comments_assoc.options.fetch(:key)
358
+
359
+ assert_equal @post_associations.detect { |assoc| assoc.name == :blog }, @inherited_post_associations.detect { |assoc| assoc.name == :blog }
360
+ end
361
+
362
+ test 'a serializer inheriting from another serializer can have an additional association with the same name but with different key' do
363
+ expected = [:author, :comments, :blog, :reviews].sort
364
+ result = @inherited_post_serializer.associations.map { |a| a.options.fetch(:key, a.name) }.sort
365
+ assert_equal(result, expected)
366
+ end
367
+ end
293
368
  end
294
369
  end
295
370
  end
@@ -81,7 +81,7 @@ module ActiveModel
81
81
  assert_equal('custom', hash[:blog][:id])
82
82
  end
83
83
 
84
- PostWithVirtualAttribute = Class.new(::Model)
84
+ class PostWithVirtualAttribute < ::Model; end
85
85
  class PostWithVirtualAttributeSerializer < ActiveModel::Serializer
86
86
  attribute :name do
87
87
  "#{object.first_name} #{object.last_name}"
@@ -28,8 +28,8 @@ module ActiveModel
28
28
 
29
29
  class SerializerTest < ActiveSupport::TestCase
30
30
  module ResourceNamespace
31
- Post = Class.new(::Model)
32
- Comment = Class.new(::Model)
31
+ class Post < ::Model; end
32
+ class Comment < ::Model; end
33
33
 
34
34
  class PostSerializer < ActiveModel::Serializer
35
35
  class CommentSerializer < ActiveModel::Serializer
@@ -46,7 +46,7 @@ module ActiveModel
46
46
  end
47
47
  end
48
48
 
49
- Tweet = Class.new(::Model)
49
+ class Tweet < ::Model; end
50
50
  TweetSerializer = Class.new
51
51
 
52
52
  def setup
@@ -0,0 +1,87 @@
1
+ require 'test_helper'
2
+
3
+ module ActiveModel
4
+ class Serializer
5
+ class SerializerForWithNamespaceTest < ActiveSupport::TestCase
6
+ class Book < ::Model; end
7
+ class Page < ::Model; end
8
+ class Publisher < ::Model; end
9
+
10
+ module Api
11
+ module V3
12
+ class BookSerializer < ActiveModel::Serializer
13
+ attributes :title, :author_name
14
+
15
+ has_many :pages
16
+ belongs_to :publisher
17
+ end
18
+
19
+ class PageSerializer < ActiveModel::Serializer
20
+ attributes :number, :text
21
+
22
+ belongs_to :book
23
+ end
24
+
25
+ class PublisherSerializer < ActiveModel::Serializer
26
+ attributes :name
27
+ end
28
+ end
29
+ end
30
+
31
+ class BookSerializer < ActiveModel::Serializer
32
+ attributes :title, :author_name
33
+ end
34
+ test 'resource without a namespace' do
35
+ book = Book.new(title: 'A Post', author_name: 'hello')
36
+
37
+ # TODO: this should be able to pull up this serializer without explicitly specifying the serializer
38
+ # currently, with no options, it still uses the Api::V3 serializer
39
+ result = ActiveModelSerializers::SerializableResource.new(book, serializer: BookSerializer).serializable_hash
40
+
41
+ expected = { title: 'A Post', author_name: 'hello' }
42
+ assert_equal expected, result
43
+ end
44
+
45
+ test 'resource with namespace' do
46
+ book = Book.new(title: 'A Post', author_name: 'hi')
47
+
48
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
49
+
50
+ expected = { title: 'A Post', author_name: 'hi', pages: nil, publisher: nil }
51
+ assert_equal expected, result
52
+ end
53
+
54
+ test 'has_many with nested serializer under the namespace' do
55
+ page = Page.new(number: 1, text: 'hello')
56
+ book = Book.new(title: 'A Post', author_name: 'hi', pages: [page])
57
+
58
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
59
+
60
+ expected = {
61
+ title: 'A Post', author_name: 'hi',
62
+ publisher: nil,
63
+ pages: [{
64
+ number: 1, text: 'hello'
65
+ }]
66
+ }
67
+ assert_equal expected, result
68
+ end
69
+
70
+ test 'belongs_to with nested serializer under the namespace' do
71
+ publisher = Publisher.new(name: 'Disney')
72
+ book = Book.new(title: 'A Post', author_name: 'hi', publisher: publisher)
73
+
74
+ result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash
75
+
76
+ expected = {
77
+ title: 'A Post', author_name: 'hi',
78
+ pages: nil,
79
+ publisher: {
80
+ name: 'Disney'
81
+ }
82
+ }
83
+ assert_equal expected, result
84
+ end
85
+ end
86
+ end
87
+ end
@@ -9,6 +9,22 @@ module SerializationTesting
9
9
  ActiveModelSerializers::SerializableResource.new(obj).to_json
10
10
  end
11
11
 
12
+ def with_namespace_separator(separator)
13
+ original_separator = ActiveModelSerializers.config.jsonapi_namespace_separator
14
+ ActiveModelSerializers.config.jsonapi_namespace_separator = separator
15
+ yield
16
+ ensure
17
+ ActiveModelSerializers.config.jsonapi_namespace_separator = original_separator
18
+ end
19
+
20
+ def with_prepended_lookup(lookup_proc)
21
+ original_lookup = ActiveModelSerializers.config.serializer_lookup_cahin
22
+ ActiveModelSerializers.config.serializer_lookup_chain.unshift lookup_proc
23
+ yield
24
+ ensure
25
+ ActiveModelSerializers.config.serializer_lookup_cahin = original_lookup
26
+ end
27
+
12
28
  # Aliased as :with_configured_adapter to clarify that
13
29
  # this method tests the configured adapter.
14
30
  # When not testing configuration, it may be preferable
@@ -9,6 +9,7 @@ rescue LoadError
9
9
  STDERR.puts 'Running without SimpleCov'
10
10
  end
11
11
 
12
+ require 'pry'
12
13
  require 'timecop'
13
14
  require 'rails'
14
15
  require 'action_controller'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Klabnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -60,7 +60,7 @@ dependencies:
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '6'
63
- type: :runtime
63
+ type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
@@ -74,14 +74,14 @@ dependencies:
74
74
  name: jsonapi
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - "~>"
77
+ - - '='
78
78
  - !ruby/object:Gem::Version
79
79
  version: 0.1.1.beta2
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - "~>"
84
+ - - '='
85
85
  - !ruby/object:Gem::Version
86
86
  version: 0.1.1.beta2
87
87
  - !ruby/object:Gem::Dependency
@@ -249,6 +249,7 @@ files:
249
249
  - ".simplecov"
250
250
  - ".travis.yml"
251
251
  - CHANGELOG.md
252
+ - CODE_OF_CONDUCT.md
252
253
  - CONTRIBUTING.md
253
254
  - Gemfile
254
255
  - MIT-LICENSE
@@ -275,11 +276,14 @@ files:
275
276
  - docs/general/serializers.md
276
277
  - docs/how-open-source-maintained.jpg
277
278
  - docs/howto/add_pagination_links.md
279
+ - docs/howto/add_relationship_links.md
278
280
  - docs/howto/add_root_key.md
281
+ - docs/howto/grape_integration.md
279
282
  - docs/howto/outside_controller_use.md
280
283
  - docs/howto/passing_arbitrary_options.md
281
284
  - docs/howto/serialize_poro.md
282
285
  - docs/howto/test.md
286
+ - docs/howto/upgrade_from_0_8_to_0_10.md
283
287
  - docs/integrations/ember-and-json-api.md
284
288
  - docs/integrations/grape.md
285
289
  - docs/jsonapi/errors.md
@@ -298,27 +302,27 @@ files:
298
302
  - lib/active_model/serializer/adapter/null.rb
299
303
  - lib/active_model/serializer/array_serializer.rb
300
304
  - lib/active_model/serializer/association.rb
301
- - lib/active_model/serializer/associations.rb
302
305
  - lib/active_model/serializer/attribute.rb
303
- - lib/active_model/serializer/attributes.rb
304
306
  - lib/active_model/serializer/belongs_to_reflection.rb
305
- - lib/active_model/serializer/caching.rb
306
307
  - lib/active_model/serializer/collection_reflection.rb
307
308
  - lib/active_model/serializer/collection_serializer.rb
308
- - lib/active_model/serializer/configuration.rb
309
+ - lib/active_model/serializer/concerns/associations.rb
310
+ - lib/active_model/serializer/concerns/attributes.rb
311
+ - lib/active_model/serializer/concerns/caching.rb
312
+ - lib/active_model/serializer/concerns/configuration.rb
313
+ - lib/active_model/serializer/concerns/links.rb
314
+ - lib/active_model/serializer/concerns/meta.rb
315
+ - lib/active_model/serializer/concerns/type.rb
309
316
  - lib/active_model/serializer/error_serializer.rb
310
317
  - lib/active_model/serializer/errors_serializer.rb
311
318
  - lib/active_model/serializer/field.rb
312
319
  - lib/active_model/serializer/fieldset.rb
313
320
  - lib/active_model/serializer/has_many_reflection.rb
314
321
  - lib/active_model/serializer/has_one_reflection.rb
315
- - lib/active_model/serializer/links.rb
316
322
  - lib/active_model/serializer/lint.rb
317
- - lib/active_model/serializer/meta.rb
318
323
  - lib/active_model/serializer/null.rb
319
324
  - lib/active_model/serializer/reflection.rb
320
325
  - lib/active_model/serializer/singular_reflection.rb
321
- - lib/active_model/serializer/type.rb
322
326
  - lib/active_model/serializer/version.rb
323
327
  - lib/active_model_serializers.rb
324
328
  - lib/active_model_serializers/adapter.rb
@@ -341,6 +345,7 @@ files:
341
345
  - lib/active_model_serializers/json_pointer.rb
342
346
  - lib/active_model_serializers/key_transform.rb
343
347
  - lib/active_model_serializers/logging.rb
348
+ - lib/active_model_serializers/lookup_chain.rb
344
349
  - lib/active_model_serializers/model.rb
345
350
  - lib/active_model_serializers/railtie.rb
346
351
  - lib/active_model_serializers/register_jsonapi_renderer.rb
@@ -361,9 +366,12 @@ files:
361
366
  - test/action_controller/json/include_test.rb
362
367
  - test/action_controller/json_api/deserialization_test.rb
363
368
  - test/action_controller/json_api/errors_test.rb
369
+ - test/action_controller/json_api/fields_test.rb
364
370
  - test/action_controller/json_api/linked_test.rb
365
371
  - test/action_controller/json_api/pagination_test.rb
366
372
  - test/action_controller/json_api/transform_test.rb
373
+ - test/action_controller/lookup_proc_test.rb
374
+ - test/action_controller/namespace_lookup_test.rb
367
375
  - test/action_controller/serialization_scope_name_test.rb
368
376
  - test/action_controller/serialization_test.rb
369
377
  - test/active_model_serializers/adapter_for_test.rb
@@ -377,6 +385,7 @@ files:
377
385
  - test/active_model_serializers/test/schema_test.rb
378
386
  - test/active_model_serializers/test/serializer_test.rb
379
387
  - test/active_record_test.rb
388
+ - test/adapter/attributes_test.rb
380
389
  - test/adapter/deprecation_test.rb
381
390
  - test/adapter/json/belongs_to_test.rb
382
391
  - test/adapter/json/collection_test.rb
@@ -390,13 +399,13 @@ files:
390
399
  - test/adapter/json_api/has_many_explicit_serializer_test.rb
391
400
  - test/adapter/json_api/has_many_test.rb
392
401
  - test/adapter/json_api/has_one_test.rb
402
+ - test/adapter/json_api/include_data_if_sideloaded_test.rb
393
403
  - test/adapter/json_api/json_api_test.rb
394
404
  - test/adapter/json_api/linked_test.rb
395
405
  - test/adapter/json_api/links_test.rb
396
406
  - test/adapter/json_api/pagination_links_test.rb
397
407
  - test/adapter/json_api/parse_test.rb
398
408
  - test/adapter/json_api/relationship_test.rb
399
- - test/adapter/json_api/relationships_test.rb
400
409
  - test/adapter/json_api/resource_identifier_test.rb
401
410
  - test/adapter/json_api/resource_meta_test.rb
402
411
  - test/adapter/json_api/toplevel_jsonapi_test.rb
@@ -409,7 +418,10 @@ files:
409
418
  - test/array_serializer_test.rb
410
419
  - test/benchmark/app.rb
411
420
  - test/benchmark/benchmarking_support.rb
421
+ - test/benchmark/bm_active_record.rb
422
+ - test/benchmark/bm_adapter.rb
412
423
  - test/benchmark/bm_caching.rb
424
+ - test/benchmark/bm_lookup_chain.rb
413
425
  - test/benchmark/bm_transform.rb
414
426
  - test/benchmark/config.ru
415
427
  - test/benchmark/controllers.rb
@@ -438,6 +450,7 @@ files:
438
450
  - test/serializers/root_test.rb
439
451
  - test/serializers/serialization_test.rb
440
452
  - test/serializers/serializer_for_test.rb
453
+ - test/serializers/serializer_for_with_namespace_test.rb
441
454
  - test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json
442
455
  - test/support/isolated_unit.rb
443
456
  - test/support/rails5_shims.rb
@@ -480,9 +493,12 @@ test_files:
480
493
  - test/action_controller/json/include_test.rb
481
494
  - test/action_controller/json_api/deserialization_test.rb
482
495
  - test/action_controller/json_api/errors_test.rb
496
+ - test/action_controller/json_api/fields_test.rb
483
497
  - test/action_controller/json_api/linked_test.rb
484
498
  - test/action_controller/json_api/pagination_test.rb
485
499
  - test/action_controller/json_api/transform_test.rb
500
+ - test/action_controller/lookup_proc_test.rb
501
+ - test/action_controller/namespace_lookup_test.rb
486
502
  - test/action_controller/serialization_scope_name_test.rb
487
503
  - test/action_controller/serialization_test.rb
488
504
  - test/active_model_serializers/adapter_for_test.rb
@@ -496,6 +512,7 @@ test_files:
496
512
  - test/active_model_serializers/test/schema_test.rb
497
513
  - test/active_model_serializers/test/serializer_test.rb
498
514
  - test/active_record_test.rb
515
+ - test/adapter/attributes_test.rb
499
516
  - test/adapter/deprecation_test.rb
500
517
  - test/adapter/json/belongs_to_test.rb
501
518
  - test/adapter/json/collection_test.rb
@@ -509,13 +526,13 @@ test_files:
509
526
  - test/adapter/json_api/has_many_explicit_serializer_test.rb
510
527
  - test/adapter/json_api/has_many_test.rb
511
528
  - test/adapter/json_api/has_one_test.rb
529
+ - test/adapter/json_api/include_data_if_sideloaded_test.rb
512
530
  - test/adapter/json_api/json_api_test.rb
513
531
  - test/adapter/json_api/linked_test.rb
514
532
  - test/adapter/json_api/links_test.rb
515
533
  - test/adapter/json_api/pagination_links_test.rb
516
534
  - test/adapter/json_api/parse_test.rb
517
535
  - test/adapter/json_api/relationship_test.rb
518
- - test/adapter/json_api/relationships_test.rb
519
536
  - test/adapter/json_api/resource_identifier_test.rb
520
537
  - test/adapter/json_api/resource_meta_test.rb
521
538
  - test/adapter/json_api/toplevel_jsonapi_test.rb
@@ -528,7 +545,10 @@ test_files:
528
545
  - test/array_serializer_test.rb
529
546
  - test/benchmark/app.rb
530
547
  - test/benchmark/benchmarking_support.rb
548
+ - test/benchmark/bm_active_record.rb
549
+ - test/benchmark/bm_adapter.rb
531
550
  - test/benchmark/bm_caching.rb
551
+ - test/benchmark/bm_lookup_chain.rb
532
552
  - test/benchmark/bm_transform.rb
533
553
  - test/benchmark/config.ru
534
554
  - test/benchmark/controllers.rb
@@ -557,6 +577,7 @@ test_files:
557
577
  - test/serializers/root_test.rb
558
578
  - test/serializers/serialization_test.rb
559
579
  - test/serializers/serializer_for_test.rb
580
+ - test/serializers/serializer_for_with_namespace_test.rb
560
581
  - test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json
561
582
  - test/support/isolated_unit.rb
562
583
  - test/support/rails5_shims.rb