search for: level_one

Displaying 1 result from an estimated 1 matches for "level_one".

2009 Jan 09
2
Confused about to_xml() in ActiveRecord::Base subclass
...wn to_xml. # Examples online show the following as how to override to_xml: def to_xml(options = {}) options[:indent] ||= 2 xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent]) xml.instruct! unless options[:skip_instruct] # v v v xml.level_one do xml.tag!(:second_level, ''content'') end # ^ ^ ^ end end The code between the v and ^ markers is where the body of each XML object is generated. If I were generating by hand, I would do something like this: errors.each do |err| s << "<id&...