我在Rails v2.3应用程序中看到了一些代码.
在layout/car_general.html.erb
中(该视图由cars_controller中的方法调用),我看到了代码:
<body>
<%= yield %>
<%= javascript_include_tag 'jquery-1.4.2.min' %>
<% javascript_tag do %>
<%= yield :jstemplates %>
var some_car = new Object;
<%= yield :some_car %>
<% end -%>
</body>
要问两个问题:
- Where can I find the yield content of the first <%=yield%> under
<body>
. - 使用rails在视图中包含js代码是rails特有的方式吗