active_model_serializers 0.9.9 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52331f8ebc5267f272b9823aca4573af1f8a3493ff31ab42255a62003ec21c7e
4
- data.tar.gz: c050584bb445c216b604b33ea421c5705e0a7a35842d609edf2b2ce87f0facf5
3
+ metadata.gz: f1c2dbb7d1b6d7673364e690d624e5a8dffa5fddf2f9ee9d6838ac399ab14a96
4
+ data.tar.gz: 5fcef7df6ec5deb692b68ffd8198e438b8bf2bafe812d12ace97087f9eb9c3f8
5
5
  SHA512:
6
- metadata.gz: 7f1799ea050b2e12bc6ea3ca43b121801a0b33858ad3ad2e3b503d940a0439ceb83ab596d53e9cb46bc85dc25e92af8350d0f54db6eea51cb867a8bb475766dc
7
- data.tar.gz: 6c0d80acada0ae9f37638fe5ca5a95a23c43faaafba1f6474a6f337f2faadca92b587f5c83dbbe1b6ecbd38169e334940ed685dfcd88cf9c44bd7d9887667e04
6
+ metadata.gz: 281b4a64ab65e4f2aff6b45a393e684e1d69a5fe203c450268cfc001deb20fce6e1269c9aafd1bf54e847bc5a282cfd28f630cb45096ec750bb531363cd93cbd
7
+ data.tar.gz: 13cd7cfa482532515a8629c35c4e5c0847b1dd791494025f4d6177e05f45f5845641b8bc04cfb543a503b8767afcb8505fd1c433afc0cd73c5bcd0d9a8066119
data/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  ## 0.09.x
2
2
 
3
- ### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.9...0-9-stable)
3
+ ### [0-9-stable](https://github.com/rails-api/active_model_serializers/compare/v0.9.11...0-9-stable)
4
+
5
+ ### [v0.9.11 (2024-04-09)](https://github.com/rails-api/active_model_serializers/compare/v0.9.10...v0.9.11)
6
+
7
+ v0.9.10 was built with an extra file included and so was yanked.
8
+ v0.9.11 is the same as v0.9.10 but doesn't have the extra file.
9
+
10
+ ### [v0.9.10 (2024-04-09)](https://github.com/rails-api/active_model_serializers/compare/v0.9.9...v0.9.10)
11
+
12
+ - Fix
13
+ - [#2464](https://github.com/rails-api/active_model_serializers/pull/2464) Do not load ActionController::TestCase in production (@byroot)
14
+ - Perf
15
+ - [#2465](https://github.com/rails-api/active_model_serializers/pull/2465) Make compatible with enable-frozen-string-literal (@byroot)
16
+ - [#2463](https://github.com/rails-api/active_model_serializers/pull/2463) Shape Friendly ActionController:Serialization (@byroot)
17
+ - Chore
18
+ - [#2462](https://github.com/rails-api/active_model_serializers/pull/2462]) Rails 7.1, Ruby 3.3 compat (@byroot)
19
+ - Test
20
+ - [#2447](https://github.com/rails-api/active_model_serializers/pull/2447) Configure CI on GitHub actoins (@Physium)
4
21
 
5
22
  ### [v0.9.9 (2023-05-18)](https://github.com/rails-api/active_model_serializers/compare/v0.9.8...v0.9.8)
6
23
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/class/attribute'
2
4
 
3
5
  module ActionController
@@ -45,6 +47,12 @@ module ActionController
45
47
  end
46
48
  end
47
49
 
50
+ def initialize(*)
51
+ super
52
+ @namespace_for_serializer = nil
53
+ end
54
+ ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
55
+
48
56
  [:_render_option_json, :_render_with_renderer_json].each do |renderer_method|
49
57
  define_method renderer_method do |resource, options|
50
58
  serializer = build_json_serializer(resource, options)
@@ -60,7 +68,8 @@ module ActionController
60
68
  private
61
69
 
62
70
  def namespace_for_serializer
63
- @namespace_for_serializer ||= namespace_for_class(self.class) unless namespace_for_class(self.class) == Object
71
+ @namespace_for_serializer ||= namespace_for_class(self.class)
72
+ @namespace_for_serializer unless @namespace_for_serializer == Object
64
73
  end
65
74
 
66
75
  def namespace_for_class(klass)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionController
2
4
  module SerializationAssertions
3
5
  extend ActiveSupport::Concern
@@ -24,6 +26,7 @@ module ActionController
24
26
  @serializers = Hash.new(0)
25
27
  super
26
28
  end
29
+ ruby2_keywords :process if respond_to?(:ruby2_keywords, true)
27
30
 
28
31
  # Asserts that the request was rendered with the appropriate serializers.
29
32
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model/default_serializer'
2
4
  require 'active_model/serializable'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model/serializable'
2
4
 
3
5
  module ActiveModel
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  module Serializable
3
5
  module Utils
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model/serializable/utils'
2
4
 
3
5
  module ActiveModel
4
6
  module Serializable
5
- INSTRUMENTATION_KEY = '!serialize.active_model_serializers'.freeze
7
+ INSTRUMENTATION_KEY = '!serialize.active_model_serializers'
6
8
 
7
9
  def self.included(base)
8
10
  base.extend Utils
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Serializer
3
5
  class Association
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Serializer
3
5
  class Association
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model/default_serializer'
2
4
  require 'active_model/serializer/association/has_one'
3
5
  require 'active_model/serializer/association/has_many'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Serializer
3
5
  class Config
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/rails/resource/resource_generator'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rails
2
4
  module Generators
3
5
  class SerializerGenerator < NamedBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Railtie < Rails::Railtie
3
5
  initializer 'generators' do |app|
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  class Serializer
3
- VERSION = '0.9.9'.freeze
5
+ VERSION = '0.9.11'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model/array_serializer'
2
4
  require 'active_model/serializable'
3
5
  require 'active_model/serializer/association'
@@ -130,14 +132,13 @@ end
130
132
  end
131
133
 
132
134
  def build_serializer_class(resource, options)
133
- "".tap do |klass_name|
134
- klass_name << "#{options[:namespace]}::" if options[:namespace]
135
- klass_name << options[:prefix].to_s.classify if options[:prefix]
136
- if resource.is_a?(String)
137
- klass_name << "#{resource}Serializer"
138
- else
139
- klass_name << "#{resource.class.name}Serializer"
140
- end
135
+ klass_name = +""
136
+ klass_name << "#{options[:namespace]}::" if options[:namespace]
137
+ klass_name << options[:prefix].to_s.classify if options[:prefix]
138
+ if resource.is_a?(String)
139
+ klass_name << "#{resource}Serializer"
140
+ else
141
+ klass_name << "#{resource.class.name}Serializer"
141
142
  end
142
143
  end
143
144
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveModel
2
4
  module SerializerSupport
3
5
  alias read_attribute_for_serialization send
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_model'
2
4
  require 'active_model/serializer'
3
5
  require 'active_model/serializer_support'
@@ -7,12 +9,22 @@ require 'active_model/serializer/railtie' if defined?(Rails)
7
9
  begin
8
10
  require 'action_controller'
9
11
  require 'action_controller/serialization'
10
- require 'action_controller/serialization_test_case'
11
12
 
12
13
  ActiveSupport.on_load(:action_controller) do
13
14
  if ::ActionController::Serialization.enabled
14
15
  ActionController::Base.send(:include, ::ActionController::Serialization)
15
- ActionController::TestCase.send(:include, ::ActionController::SerializationAssertions)
16
+
17
+ # action_controller_test_case load hook was added in Rails 5.1
18
+ # https://github.com/rails/rails/commit/0510208dd1ff23baa619884c0abcae4d141fae53
19
+ if ActiveSupport::VERSION::STRING < '5.1'
20
+ require 'action_controller/serialization_test_case'
21
+ ActionController::TestCase.send(:include, ::ActionController::SerializationAssertions)
22
+ else
23
+ ActiveSupport.on_load(:action_controller_test_case) do
24
+ require 'action_controller/serialization_test_case'
25
+ ActionController::TestCase.send(:include, ::ActionController::SerializationAssertions)
26
+ end
27
+ end
16
28
  end
17
29
  end
18
30
  rescue LoadError
@@ -13,7 +13,7 @@ module ActionController
13
13
 
14
14
  def test_render_using_implicit_serializer
15
15
  get :render_using_implicit_serializer
16
- assert_equal 'application/json', @response.content_type
16
+ assert_includes @response.content_type, 'application/json'
17
17
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1"}}', @response.body
18
18
  end
19
19
  end
@@ -35,7 +35,7 @@ module ActionController
35
35
 
36
36
  def test_render_using_implicit_serializer_and_scope
37
37
  get :render_using_implicit_serializer_and_scope
38
- assert_equal 'application/json', @response.content_type
38
+ assert_includes @response.content_type, 'application/json'
39
39
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_user"}}', @response.body
40
40
  end
41
41
  end
@@ -65,7 +65,7 @@ module ActionController
65
65
 
66
66
  def test_render_using_scope_set_in_default_serializer_options
67
67
  get :render_using_scope_set_in_default_serializer_options
68
- assert_equal 'application/json', @response.content_type
68
+ assert_includes @response.content_type, 'application/json'
69
69
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
70
70
  end
71
71
  end
@@ -91,7 +91,7 @@ module ActionController
91
91
 
92
92
  def test_render_using_implicit_serializer_and_explicit_scope
93
93
  get :render_using_implicit_serializer_and_explicit_scope
94
- assert_equal 'application/json', @response.content_type
94
+ assert_includes @response.content_type, 'application/json'
95
95
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
96
96
  end
97
97
  end
@@ -117,7 +117,7 @@ module ActionController
117
117
 
118
118
  def test_render_overriding_serialization_scope
119
119
  get :render_overriding_serialization_scope
120
- assert_equal 'application/json', @response.content_type
120
+ assert_includes @response.content_type, 'application/json'
121
121
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
122
122
  end
123
123
  end
@@ -141,7 +141,7 @@ module ActionController
141
141
 
142
142
  def test_render_calling_serialization_scope
143
143
  get :render_calling_serialization_scope
144
- assert_equal 'application/json', @response.content_type
144
+ assert_includes @response.content_type, 'application/json'
145
145
  assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_user"}}', @response.body
146
146
  end
147
147
  end
@@ -157,7 +157,7 @@ module ActionController
157
157
 
158
158
  def test_render_using_json_dump
159
159
  get :render_using_json_dump
160
- assert_equal 'application/json', @response.content_type
160
+ assert_includes @response.content_type, 'application/json'
161
161
  assert_equal '{"hello":"world"}', @response.body
162
162
  end
163
163
  end
@@ -173,7 +173,7 @@ module ActionController
173
173
 
174
174
  def test_render_using_rails_behavior
175
175
  get :render_using_rails_behavior
176
- assert_equal 'application/json', @response.content_type
176
+ assert_includes @response.content_type, 'application/json'
177
177
  assert_equal '[{"attributes":{"name":"Name 1","description":"Description 1","comments":"Comments 1"}}]', @response.body
178
178
  end
179
179
  end
@@ -189,7 +189,7 @@ module ActionController
189
189
 
190
190
  def test_render_array
191
191
  get :render_array
192
- assert_equal 'application/json', @response.content_type
192
+ assert_includes @response.content_type, 'application/json'
193
193
  assert_equal '{"my":[{"name":"Name 1","description":"Description 1"}]}', @response.body
194
194
  end
195
195
  end
@@ -205,7 +205,7 @@ module ActionController
205
205
 
206
206
  def test_render_array
207
207
  get :render_array
208
- assert_equal 'application/json', @response.content_type
208
+ assert_includes @response.content_type, 'application/json'
209
209
  assert_equal '{"webLog":[{"name":"Name 1","displayName":"Display Name 1"},{"name":"Name 2","displayName":"Display Name 2"}]}', @response.body
210
210
  end
211
211
  end
@@ -223,7 +223,7 @@ module ActionController
223
223
 
224
224
  def test_render_without_root
225
225
  get :render_without_root
226
- assert_equal 'application/json', @response.content_type
226
+ assert_includes @response.content_type, 'application/json'
227
227
  assert_equal '{"name":"Name 1","displayName":"Display Name 1"}', @response.body
228
228
  end
229
229
  end
@@ -242,7 +242,7 @@ module ActionController
242
242
 
243
243
  def test_render_array_without_root
244
244
  get :render_array_without_root
245
- assert_equal 'application/json', @response.content_type
245
+ assert_includes @response.content_type, 'application/json'
246
246
  assert_equal '[{"name":"Name 1","displayName":"Display Name 1"},{"name":"Name 2","displayName":"Display Name 2"}]', @response.body
247
247
  end
248
248
  end
@@ -278,7 +278,7 @@ module ActionController
278
278
  @association.embed_in_root = true
279
279
 
280
280
  get :render_array_embeding_in_root
281
- assert_equal 'application/json', @response.content_type
281
+ assert_includes @response.content_type, 'application/json'
282
282
 
283
283
  assert_equal("{\"my\":[{\"name\":\"Name 1\",\"email\":\"mail@server.com\",\"profile_id\":#{@controller.user.profile.object_id}}],\"profiles\":[{\"name\":\"N1\",\"description\":\"D1\"}]}", @response.body)
284
284
  end
data/test/test_helper.rb CHANGED
@@ -2,8 +2,13 @@ require 'bundler/setup'
2
2
  require 'minitest/autorun'
3
3
  require 'active_model_serializers'
4
4
  require 'fixtures/poro'
5
- require 'rails-controller-testing'
6
- Rails::Controller::Testing.install
5
+ begin
6
+ require 'rails-controller-testing'
7
+ Rails::Controller::Testing.install
8
+ rescue LoadError
9
+ false # Rails 5 < backward compatibility
10
+ end
11
+
7
12
 
8
13
  # Ensure backward compatibility with Minitest 4
9
14
  Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
@@ -66,8 +66,8 @@ module ActiveModel
66
66
  serializer = ArraySerializer.new(array)
67
67
 
68
68
  expected = [
69
- { name: 'Test 1', email: 'test1@test.com', sub_test: { name: 'Name 1', description: 'Description 1' }},
70
- { name: 'Test 1', email: 'test2@test.com', sub_test: { name: 'Name 2', description: 'Description 2' }}
69
+ { name: 'Test 1', email: 'test1@test.com', sub_test: { name: 'Name 1', description: 'Description 1' } },
70
+ { name: 'Test 2', email: 'test2@test.com', sub_test: { name: 'Name 2', description: 'Description 2' } }
71
71
  ]
72
72
 
73
73
  assert_equal expected, serializer.serializable_array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-05-18 00:00:00.000000000 Z
13
+ date: 2024-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -89,7 +89,6 @@ files:
89
89
  - lib/active_model/serializer/version.rb
90
90
  - lib/active_model/serializer_support.rb
91
91
  - lib/active_model_serializers.rb
92
- - lib/active_model_serializers/model/caching.rb
93
92
  - test/benchmark/app.rb
94
93
  - test/benchmark/benchmarking_support.rb
95
94
  - test/benchmark/bm_active_record.rb
@@ -167,67 +166,67 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
166
  - !ruby/object:Gem::Version
168
167
  version: '0'
169
168
  requirements: []
170
- rubygems_version: 3.1.6
169
+ rubygems_version: 3.3.7
171
170
  signing_key:
172
171
  specification_version: 4
173
172
  summary: Bringing consistency and object orientation to model serialization. Works
174
173
  great for client-side MVC frameworks!
175
174
  test_files:
176
175
  - test/benchmark/app.rb
177
- - test/benchmark/setup.rb
176
+ - test/benchmark/benchmarking_support.rb
178
177
  - test/benchmark/bm_active_record.rb
179
- - test/benchmark/tmp/miniprofiler/mp_timers_m8fpoz2cvt3g9agz0bs3
180
- - test/benchmark/tmp/miniprofiler/mp_timers_s15t1a6mvxe0z7vjv790
181
- - test/benchmark/tmp/miniprofiler/mp_timers_hjry5rc32imd42oxoi48
182
- - test/benchmark/tmp/miniprofiler/mp_timers_qg52tpca3uesdfguee9i
183
- - test/benchmark/tmp/miniprofiler/mp_views_127.0.0.1
178
+ - test/benchmark/setup.rb
179
+ - test/benchmark/tmp/miniprofiler/mp_timers_6eqewtfgrhitvq5gqm25
180
+ - test/benchmark/tmp/miniprofiler/mp_timers_8083sx03hu72pxz1a4d0
184
181
  - test/benchmark/tmp/miniprofiler/mp_timers_fyz2gsml4z0ph9kpoy1c
182
+ - test/benchmark/tmp/miniprofiler/mp_timers_hjry5rc32imd42oxoi48
183
+ - test/benchmark/tmp/miniprofiler/mp_timers_m8fpoz2cvt3g9agz0bs3
185
184
  - test/benchmark/tmp/miniprofiler/mp_timers_p92m2drnj1i568u3sta0
186
- - test/benchmark/tmp/miniprofiler/mp_timers_6eqewtfgrhitvq5gqm25
185
+ - test/benchmark/tmp/miniprofiler/mp_timers_qg52tpca3uesdfguee9i
186
+ - test/benchmark/tmp/miniprofiler/mp_timers_s15t1a6mvxe0z7vjv790
187
187
  - test/benchmark/tmp/miniprofiler/mp_timers_x8kal3d17nfds6vp4kcj
188
- - test/benchmark/tmp/miniprofiler/mp_timers_8083sx03hu72pxz1a4d0
189
- - test/benchmark/benchmarking_support.rb
190
- - test/unit/active_model/serializer/config_test.rb
191
- - test/unit/active_model/serializer/has_one_test.rb
192
- - test/unit/active_model/serializer/associations/build_serializer_test.rb
193
- - test/unit/active_model/serializer/key_format_test.rb
194
- - test/unit/active_model/serializer/url_helpers_test.rb
195
- - test/unit/active_model/serializer/associations_test.rb
196
- - test/unit/active_model/serializer/options_test.rb
197
- - test/unit/active_model/serializer/attributes_test.rb
198
- - test/unit/active_model/serializer/root_test.rb
199
- - test/unit/active_model/serializer/meta_test.rb
200
- - test/unit/active_model/serializer/has_many_polymorphic_test.rb
201
- - test/unit/active_model/serializer/has_one_polymorphic_test.rb
202
- - test/unit/active_model/serializer/has_many_test.rb
203
- - test/unit/active_model/serializer/has_one_and_has_many_test.rb
204
- - test/unit/active_model/serializer/filter_test.rb
205
- - test/unit/active_model/serializer/scope_test.rb
206
- - test/unit/active_model/default_serializer_test.rb
207
- - test/unit/active_model/array_serializer/serialization_test.rb
208
- - test/unit/active_model/array_serializer/key_format_test.rb
209
- - test/unit/active_model/array_serializer/options_test.rb
210
- - test/unit/active_model/array_serializer/only_test.rb
211
- - test/unit/active_model/array_serializer/root_test.rb
212
- - test/unit/active_model/array_serializer/except_test.rb
213
- - test/unit/active_model/array_serializer/meta_test.rb
214
- - test/unit/active_model/array_serializer/scope_test.rb
215
- - test/unit/active_model/serilizable_test.rb
216
- - test/test_app.rb
188
+ - test/benchmark/tmp/miniprofiler/mp_views_127.0.0.1
189
+ - test/fixtures/active_record.rb
190
+ - test/fixtures/poro.rb
191
+ - test/fixtures/template.html.erb
192
+ - test/integration/action_controller/namespaced_serialization_test.rb
217
193
  - test/integration/action_controller/serialization_test.rb
218
194
  - test/integration/action_controller/serialization_test_case_test.rb
219
- - test/integration/action_controller/namespaced_serialization_test.rb
220
195
  - test/integration/active_record/active_record_test.rb
221
- - test/integration/generators/scaffold_controller_generator_test.rb
222
196
  - test/integration/generators/resource_generator_test.rb
197
+ - test/integration/generators/scaffold_controller_generator_test.rb
223
198
  - test/integration/generators/serializer_generator_test.rb
224
- - test/fixtures/poro.rb
225
- - test/fixtures/template.html.erb
226
- - test/fixtures/active_record.rb
199
+ - test/test_app.rb
227
200
  - test/test_helper.rb
228
- - test/tmp/app/serializers/account_serializer.rb
229
- - test/tmp/app/controllers/accounts_controller.rb
230
201
  - test/tmp/app/assets/javascripts/accounts.js
231
202
  - test/tmp/app/assets/stylesheets/accounts.css
203
+ - test/tmp/app/controllers/accounts_controller.rb
232
204
  - test/tmp/app/helpers/accounts_helper.rb
205
+ - test/tmp/app/serializers/account_serializer.rb
233
206
  - test/tmp/config/routes.rb
207
+ - test/unit/active_model/array_serializer/except_test.rb
208
+ - test/unit/active_model/array_serializer/key_format_test.rb
209
+ - test/unit/active_model/array_serializer/meta_test.rb
210
+ - test/unit/active_model/array_serializer/only_test.rb
211
+ - test/unit/active_model/array_serializer/options_test.rb
212
+ - test/unit/active_model/array_serializer/root_test.rb
213
+ - test/unit/active_model/array_serializer/scope_test.rb
214
+ - test/unit/active_model/array_serializer/serialization_test.rb
215
+ - test/unit/active_model/default_serializer_test.rb
216
+ - test/unit/active_model/serializer/associations/build_serializer_test.rb
217
+ - test/unit/active_model/serializer/associations_test.rb
218
+ - test/unit/active_model/serializer/attributes_test.rb
219
+ - test/unit/active_model/serializer/config_test.rb
220
+ - test/unit/active_model/serializer/filter_test.rb
221
+ - test/unit/active_model/serializer/has_many_polymorphic_test.rb
222
+ - test/unit/active_model/serializer/has_many_test.rb
223
+ - test/unit/active_model/serializer/has_one_and_has_many_test.rb
224
+ - test/unit/active_model/serializer/has_one_polymorphic_test.rb
225
+ - test/unit/active_model/serializer/has_one_test.rb
226
+ - test/unit/active_model/serializer/key_format_test.rb
227
+ - test/unit/active_model/serializer/meta_test.rb
228
+ - test/unit/active_model/serializer/options_test.rb
229
+ - test/unit/active_model/serializer/root_test.rb
230
+ - test/unit/active_model/serializer/scope_test.rb
231
+ - test/unit/active_model/serializer/url_helpers_test.rb
232
+ - test/unit/active_model/serilizable_test.rb
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- module ActiveModelSerializers
3
- class Model
4
- module Caching
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- attr_writer :updated_at
9
- attributes :id
10
- end
11
-
12
- # Defaults to the downcased model name and updated_at
13
- def cache_key
14
- ActiveSupport::Cache.expand_cache_key([
15
- self.class.model_name.name.downcase,
16
- "#{id}-#{updated_at.strftime('%Y%m%d%H%M%S%9N')}"
17
- ].compact)
18
- end
19
-
20
- # Defaults to the time the serializer file was modified.
21
- def updated_at
22
- defined?(@updated_at) ? @updated_at : File.mtime(__FILE__)
23
- end
24
- end
25
- end
26
- end