mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Remove dead comments
This commit is contained in:
parent
43c3c231ef
commit
ba2aa1fdfd
@ -349,31 +349,6 @@ module ActiveModel
|
||||
# @return [Hash] containing the attributes and first level
|
||||
# associations, similar to how ActiveModel::Serializers::JSON is used
|
||||
# in ActiveRecord::Base.
|
||||
#
|
||||
# TODO: Include <tt>ActiveModel::Serializers::JSON</tt>.
|
||||
# So that the below is true:
|
||||
# @param options [nil, Hash] The same valid options passed to `serializable_hash`
|
||||
# (:only, :except, :methods, and :include).
|
||||
#
|
||||
# See
|
||||
# https://github.com/rails/rails/blob/v5.0.0.beta2/activemodel/lib/active_model/serializers/json.rb#L17-L101
|
||||
# https://github.com/rails/rails/blob/v5.0.0.beta2/activemodel/lib/active_model/serialization.rb#L85-L123
|
||||
# https://github.com/rails/rails/blob/v5.0.0.beta2/activerecord/lib/active_record/serialization.rb#L11-L17
|
||||
# https://github.com/rails/rails/blob/v5.0.0.beta2/activesupport/lib/active_support/core_ext/object/json.rb#L147-L162
|
||||
#
|
||||
# @example
|
||||
# # The :only and :except options can be used to limit the attributes included, and work
|
||||
# # similar to the attributes method.
|
||||
# serializer.as_json(only: [:id, :name])
|
||||
# serializer.as_json(except: [:id, :created_at, :age])
|
||||
#
|
||||
# # To include the result of some method calls on the model use :methods:
|
||||
# serializer.as_json(methods: :permalink)
|
||||
#
|
||||
# # To include associations use :include:
|
||||
# serializer.as_json(include: :posts)
|
||||
# # Second level and higher order associations work as well:
|
||||
# serializer.as_json(include: { posts: { include: { comments: { only: :body } }, only: :title } })
|
||||
def serializable_hash(adapter_options = nil, options = {}, adapter_instance = self.class.serialization_adapter_instance)
|
||||
adapter_options ||= {}
|
||||
options[:include_directive] ||= ActiveModel::Serializer.include_directive_from_options(adapter_options)
|
||||
@ -385,13 +360,6 @@ module ActiveModel
|
||||
alias to_h serializable_hash
|
||||
|
||||
# @see #serializable_hash
|
||||
# TODO: When moving attributes adapter logic here, @see #serializable_hash
|
||||
# So that the below is true:
|
||||
# @param options [nil, Hash] The same valid options passed to `as_json`
|
||||
# (:root, :only, :except, :methods, and :include).
|
||||
# The default for `root` is nil.
|
||||
# The default value for include_root is false. You can change it to true if the given
|
||||
# JSON string includes a single root node.
|
||||
def as_json(adapter_opts = nil)
|
||||
serializable_hash(adapter_opts)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user