mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Merge pull request #2428 from jpawlyn/0-10-stable
Relax gem requirement to allow Rails 7
This commit is contained in:
commit
fae99ee08a
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -13,6 +13,12 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Recent Rubies and Rails
|
# Recent Rubies and Rails
|
||||||
|
- ruby-version: '3.1'
|
||||||
|
rails-version: '7.0'
|
||||||
|
- ruby-version: '3.0'
|
||||||
|
rails-version: '7.0'
|
||||||
|
- ruby-version: '2.7'
|
||||||
|
rails-version: '7.0'
|
||||||
- ruby-version: '2.6'
|
- ruby-version: '2.6'
|
||||||
rails-version: '6.1'
|
rails-version: '6.1'
|
||||||
- ruby-version: '2.6'
|
- ruby-version: '2.6'
|
||||||
|
|||||||
@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
spec.required_ruby_version = '>= 2.1'
|
spec.required_ruby_version = '>= 2.1'
|
||||||
|
|
||||||
rails_versions = ['>= 4.1', '< 7.0']
|
rails_versions = ['>= 4.1', '< 7.1']
|
||||||
spec.add_runtime_dependency 'activemodel', rails_versions
|
spec.add_runtime_dependency 'activemodel', rails_versions
|
||||||
# 'activesupport', rails_versions
|
# 'activesupport', rails_versions
|
||||||
# 'builder'
|
# 'builder'
|
||||||
|
|||||||
@ -7,6 +7,7 @@ module ActionController
|
|||||||
class ImplicitSerializerTest < ActionController::TestCase
|
class ImplicitSerializerTest < ActionController::TestCase
|
||||||
class ImplicitSerializationTestController < ActionController::Base
|
class ImplicitSerializationTestController < ActionController::Base
|
||||||
include SerializationTesting
|
include SerializationTesting
|
||||||
|
|
||||||
def render_using_implicit_serializer
|
def render_using_implicit_serializer
|
||||||
@profile = Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
|
@profile = Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
|
||||||
render json: @profile
|
render json: @profile
|
||||||
@ -75,8 +76,12 @@ module ActionController
|
|||||||
render json: [{ error: 'Result is Invalid' }]
|
render json: [{ error: 'Result is Invalid' }]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# HACK: to prevent the resetting of instance variables after each request in Rails 7
|
||||||
|
# see https://github.com/rails/rails/pull/43735
|
||||||
|
def clear_instance_variables_between_requests; end
|
||||||
|
|
||||||
def update_and_render_object_with_cache_enabled
|
def update_and_render_object_with_cache_enabled
|
||||||
@post.updated_at = Time.zone.now
|
@post.updated_at = Time.zone.now # requires hack above to prevent `NoMethodError: undefined method `updated_at=' for nil:NilClass`
|
||||||
|
|
||||||
generate_cached_serializer(@post)
|
generate_cached_serializer(@post)
|
||||||
render json: @post
|
render json: @post
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user