提交 e67c28df 编写于 作者: R Rizwan Reza

Added headings to serializers.

上级 7d7d54fa
en: en:
errors: errors:
# The default format use in full error messages. # The default format to use in full error messages.
format: "%{attribute} %{message}" format: "%{attribute} %{message}"
# The values :model, :attribute and :value are always available for interpolation # The values :model, :attribute and :value are always available for interpolation
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
require 'active_support/core_ext/class/attribute' require 'active_support/core_ext/class/attribute'
module ActiveModel module ActiveModel
# == Active Model JSON Serializer
module Serializers module Serializers
module JSON module JSON
extend ActiveSupport::Concern extend ActiveSupport::Concern
...@@ -14,8 +15,8 @@ module JSON ...@@ -14,8 +15,8 @@ module JSON
self.include_root_in_json = true self.include_root_in_json = true
end end
# Returns a JSON string representing the model. Some configuration is # Returns a JSON string representing the model. Some configuration can be
# available through +options+. # passed through +options+.
# #
# The option <tt>ActiveModel::Base.include_root_in_json</tt> controls the # The option <tt>ActiveModel::Base.include_root_in_json</tt> controls the
# top-level behavior of to_json. It is true by default. When it is <tt>true</tt>, # top-level behavior of to_json. It is true by default. When it is <tt>true</tt>,
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/hash/slice'
module ActiveModel module ActiveModel
# == Active Model XML Serializer
module Serializers module Serializers
module Xml module Xml
extend ActiveSupport::Concern extend ActiveSupport::Concern
...@@ -131,6 +132,8 @@ def add_procs ...@@ -131,6 +132,8 @@ def add_procs
end end
end end
# Returns XML representing the model. Configuration can be
# passed through +options+.
def to_xml(options = {}, &block) def to_xml(options = {}, &block)
Serializer.new(self, options).serialize(&block) Serializer.new(self, options).serialize(&block)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册