aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-11-25 19:29:39 +0000
committerJosé Valim <jose.valim@gmail.com>2011-11-25 19:29:39 +0000
commit0a4035b12a6c59253cb60f9e3456513c6a6a9d33 (patch)
tree513faab640a046e21c4b254b25f1bd601590ba2d /actionpack/lib/action_controller
parent2dab493867d35d27015e3ba00d20ee6d2337320e (diff)
downloadrails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.tar.gz
rails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.tar.bz2
rails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.zip
Revert the serializers API as other alternatives are now also under discussion
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/serialization.rb51
1 files changed, 0 insertions, 51 deletions
diff --git a/actionpack/lib/action_controller/metal/serialization.rb b/actionpack/lib/action_controller/metal/serialization.rb
deleted file mode 100644
index 628d5996d7..0000000000
--- a/actionpack/lib/action_controller/metal/serialization.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-module ActionController
- # Action Controller Serialization
- #
- # Overrides render :json to check if the given object implements +active_model_serializer+
- # as a method. If so, use the returned serializer instead of calling +to_json+ in the object.
- #
- # This module also provides a serialization_scope method that allows you to configure the
- # +serialization_scope+ of the serializer. Most apps will likely set the +serialization_scope+
- # to the current user:
- #
- # class ApplicationController < ActionController::Base
- # serialization_scope :current_user
- # end
- #
- # If you need more complex scope rules, you can simply override the serialization_scope:
- #
- # class ApplicationController < ActionController::Base
- # private
- #
- # def serialization_scope
- # current_user
- # end
- # end
- #
- module Serialization
- extend ActiveSupport::Concern
-
- include ActionController::Renderers
-
- included do
- class_attribute :_serialization_scope
- end
-
- def serialization_scope
- send(_serialization_scope)
- end
-
- def _render_option_json(json, options)
- if json.respond_to?(:active_model_serializer) && (serializer = json.active_model_serializer)
- json = serializer.new(json, serialization_scope)
- end
- super
- end
-
- module ClassMethods
- def serialization_scope(scope)
- self._serialization_scope = scope
- end
- end
- end
-end