mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove SerializerSupport
This commit is contained in:
@@ -60,8 +60,7 @@ module ActionController
|
||||
|
||||
serializer =
|
||||
options.delete(:serializer) ||
|
||||
resource.respond_to?(:active_model_serializer) &&
|
||||
resource.active_model_serializer
|
||||
ActiveModel::Serializer.serializer_for(resource)
|
||||
|
||||
options[:scope] = serialization_scope unless options.has_key?(:scope)
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ module ActiveModel
|
||||
base._attributes = {}
|
||||
end
|
||||
|
||||
def serializer_for(resource)
|
||||
"#{resource.class.name}Serializer".safe_constantize
|
||||
end
|
||||
|
||||
attr_accessor :_root, :_attributes
|
||||
|
||||
def root(root)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
require 'active_support/core_ext/string/inflections'
|
||||
|
||||
module ActiveModel
|
||||
module SerializerSupport
|
||||
def active_model_serializer
|
||||
"#{self.class.name}Serializer".safe_constantize
|
||||
end
|
||||
|
||||
alias read_attribute_for_serialization send
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,5 @@
|
||||
require 'active_model'
|
||||
require 'active_model/serializer'
|
||||
require 'active_model/serializer_support'
|
||||
|
||||
begin
|
||||
require 'action_controller'
|
||||
@@ -12,9 +11,3 @@ begin
|
||||
rescue LoadError
|
||||
# rails not installed, continuing
|
||||
end
|
||||
|
||||
[:active_record, :mongoid].each do |orm|
|
||||
ActiveSupport.on_load(orm) do
|
||||
include ActiveModel::SerializerSupport
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user