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.
我想在说明之前知道动作控制器(json、html、xml)的响应类型:
respond_to do |format| format.html{ ... end
有可能吗?
谢谢
您可以使用,
request.format.symbol
这将列出当前的请求格式。
如果您还需要其他详细信息,我建议您检查请求对象,
p request.inpect