Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些控制器
并拥有@xyz 对象
@xyz = XYZ.new(params[:xyz])
我必须将所有字段从表单保存到 xml 文件。
那么步骤是什么。
请帮我。
我认为以下应该有效
@xyz = XYZ.new(params[:xyz]) xml_string = @xyz.to_xml File.open("some_file_name.xml", 'w') { |f| f.write(xml_string) }