method
serialize
serialize()
public
Hide source
# File activemodel/lib/active_model/serializers/xml.rb, line 70 def serialize require 'builder' unless defined? ::Builder options[:indent] ||= 2 options[:builder] ||= ::Builder::XmlMarkup.new(:indent => options[:indent]) @builder = options[:builder] @builder.instruct! unless options[:skip_instruct] root = (options[:root] || @serializable.class.model_name.element).to_s root = ActiveSupport::XmlMini.rename_key(root, options) args = [root] args << {:xmlns => options[:namespace]} if options[:namespace] args << {:type => options[:type]} if options[:type] && !options[:skip_types] @builder.tag!(*args) do add_attributes_and_methods add_includes add_extra_behavior add_procs yield @builder if block_given? end end