mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #2319 from kylekeesling/rails6
Fix deprecation warnings on Rails 6
This commit is contained in:
commit
6fb4f7b111
@ -7,6 +7,9 @@ Breaking changes:
|
|||||||
Features:
|
Features:
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
|
- [#2319](https://github.com/rails-api/active_model_serializers/pull/2319) Fixes #2316. (@kylekeesling)
|
||||||
|
- Fix Rails 6.0 deprication warnings
|
||||||
|
- update test fixture schema to use `timestamps` instead of `timestamp`
|
||||||
|
|
||||||
Misc:
|
Misc:
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,15 @@ module ActionController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def namespace_for_serializer
|
def namespace_for_serializer
|
||||||
@namespace_for_serializer ||= self.class.parent unless self.class.parent == Object
|
@namespace_for_serializer ||= namespace_for_class(self.class) unless namespace_for_class(self.class) == Object
|
||||||
|
end
|
||||||
|
|
||||||
|
def namespace_for_class(klass)
|
||||||
|
if Module.method_defined?(:module_parent)
|
||||||
|
klass.module_parent
|
||||||
|
else
|
||||||
|
klass.parent
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def serialization_scope
|
def serialization_scope
|
||||||
|
|||||||
@ -125,7 +125,12 @@ module ActionController
|
|||||||
tests Api::V3::LookupTestController
|
tests Api::V3::LookupTestController
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@test_namespace = self.class.parent
|
@test_namespace =
|
||||||
|
if Module.method_defined?(:module_parent)
|
||||||
|
self.class.module_parent
|
||||||
|
else
|
||||||
|
self.class.parent
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'uses request headers to determine the namespace' do
|
test 'uses request headers to determine the namespace' do
|
||||||
|
|||||||
10
test/fixtures/active_record.rb
vendored
10
test/fixtures/active_record.rb
vendored
@ -19,28 +19,28 @@ ActiveRecord::Schema.define do
|
|||||||
t.text :contents
|
t.text :contents
|
||||||
t.references :author
|
t.references :author
|
||||||
t.references :post
|
t.references :post
|
||||||
t.timestamp null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
create_table :employees, force: true do |t|
|
create_table :employees, force: true do |t|
|
||||||
t.string :name
|
t.string :name
|
||||||
t.string :email
|
t.string :email
|
||||||
t.timestamp null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
create_table :object_tags, force: true do |t|
|
create_table :object_tags, force: true do |t|
|
||||||
t.string :poly_tag_id
|
t.string :poly_tag_id
|
||||||
t.string :taggable_type
|
t.string :taggable_type
|
||||||
t.string :taggable_id
|
t.string :taggable_id
|
||||||
t.timestamp null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
create_table :poly_tags, force: true do |t|
|
create_table :poly_tags, force: true do |t|
|
||||||
t.string :phrase
|
t.string :phrase
|
||||||
t.timestamp null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
create_table :pictures, force: true do |t|
|
create_table :pictures, force: true do |t|
|
||||||
t.string :title
|
t.string :title
|
||||||
t.string :imageable_type
|
t.string :imageable_type
|
||||||
t.string :imageable_id
|
t.string :imageable_id
|
||||||
t.timestamp null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user