mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
@@ -30,17 +30,6 @@ module ActionController
|
||||
included do
|
||||
class_attribute :_serialization_scope
|
||||
self._serialization_scope = :current_user
|
||||
|
||||
unless self.respond_to?(:responder=)
|
||||
include ActionController::MimeResponds
|
||||
end
|
||||
|
||||
self.responder = ActiveModel::Serializer::Responder
|
||||
self.respond_to :json
|
||||
|
||||
unless ActiveModel::Serializer.use_default_render_json
|
||||
self.send(:include, RenderJsonOverride)
|
||||
end
|
||||
end
|
||||
|
||||
def serialization_scope
|
||||
@@ -50,15 +39,13 @@ module ActionController
|
||||
def default_serializer_options
|
||||
end
|
||||
|
||||
module RenderJsonOverride
|
||||
def _render_option_json(resource, options)
|
||||
json = ActiveModel::Serializer.build_json(self, resource, options)
|
||||
def _render_option_json(resource, options)
|
||||
json = ActiveModel::Serializer.build_json(self, resource, options)
|
||||
|
||||
if json
|
||||
super(json, options)
|
||||
else
|
||||
super
|
||||
end
|
||||
if json
|
||||
super(json, options)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -66,9 +66,6 @@ module ActiveModel
|
||||
self._embed = :objects
|
||||
class_attribute :_root_embed
|
||||
|
||||
class_attribute :use_default_render_json
|
||||
self.use_default_render_json = false
|
||||
|
||||
class_attribute :cache
|
||||
class_attribute :perform_caching
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
class Responder < ::ActionController::Responder #:nodoc:
|
||||
|
||||
protected
|
||||
def display(resource, given_options = {})
|
||||
if format != :json
|
||||
super
|
||||
else
|
||||
json = Serializer.build_json(controller, resource, options)
|
||||
|
||||
if json
|
||||
render given_options.merge(options).merge(:json => json)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -86,7 +86,6 @@ begin
|
||||
require 'action_controller/serialization'
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
require 'active_model/serializer/responder'
|
||||
include ::ActionController::Serialization
|
||||
end
|
||||
rescue LoadError => ex
|
||||
|
||||
Reference in New Issue
Block a user