【发布时间】:2013-10-17 13:14:56
【问题描述】:
我有一个 Rails 控制器,它将以 XML 格式输出哈希 - 例如:
class MyController < ApplicationController
# GET /example.xml
def index
@output = {"a" => "b"}
respond_to do |format|
format.xml {render :xml => @output}
end
end
end
但是,Rails 添加了一个我不想要的
<hash>
<a>
b
</a>
</hash>
我怎样才能输出这个呢?
<a>
b
</a>
【问题讨论】:
标签: ruby-on-rails