如果对同一个动作你有一个 rhtml 及一个 rjs 模板,我的理解是动作代码至少看起来像这样:
respond_to do |type|
type.html
type.js
end
我对这种简单情况的建议是尽可能使用下面句法:
respond_to(:html, :js)
甚至,我们可以有个合理的缺省类型优先选择次序,因此那个 respond_to 根本没有必要,对这些简单情况,为需要为每个类型提供代码。
Am I making sense? Did I get this stuff right? Let me know what you think about it and I'll see if I can get a patch going.
http://lists.rubyonrails.org/pipermail/rails-core/2006-March/001099.html |