-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved the adapter and adapter folder to active_model_serializers folder and changed the module namespace #1535
Changes from all commits
252f9c4
25c9df0
e353906
fcdb58f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'set' | ||
require 'active_model_serializers/adapter' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✂️ as is autoloaded now |
||
module ActiveModel | ||
class SerializableResource | ||
ADAPTER_OPTION_KEYS = Set.new([:include, :fields, :adapter, :meta, :meta_key, :links]) | ||
|
@@ -30,7 +31,7 @@ def serialization_scope_name=(scope_name) | |
end | ||
|
||
def adapter | ||
@adapter ||= ActiveModel::Serializer::Adapter.create(serializer_instance, adapter_opts) | ||
@adapter ||= ActiveModelSerializers::Adapter.create(serializer_instance, adapter_opts) | ||
end | ||
alias_method :adapter_instance, :adapter | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ class Serializer | |
include Links | ||
include Meta | ||
include Type | ||
require 'active_model/serializer/adapter' | ||
|
||
# @param resource [ActiveRecord::Base, ActiveModelSerializers::Model] | ||
# @return [ActiveModel::Serializer] | ||
|
@@ -42,9 +41,11 @@ def self.serializer_for(resource, options = {}) | |
end | ||
end | ||
|
||
# @see ActiveModel::Serializer::Adapter.lookup | ||
# @see ActiveModelSerializers::Adapter.lookup | ||
# Deprecated | ||
def self.adapter | ||
ActiveModel::Serializer::Adapter.lookup(config.adapter) | ||
warn 'Calling adapter method in Serializer, please use the ActiveModelSerializers::configured_adapter' | ||
ActiveModelSerializers::Adapter.lookup(config.adapter) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this was deprecated, I just want to point that the tests for this were also removed. I reckon that the code here and in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's fine. |
||
end | ||
|
||
# @api private | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file shouldn't be changing at all. weird