Rails 3.2.1:我有一个部分的表单标签,如下所示:
<%= form_for @new_thing, :remote => true, :url => thing_path, :html => { :id => 'thing_form', 'data-type' => 'script' } do |f| %>
<p><%= f.text_field :thing %></p>
<p><%= submit_tag %></p>
thing_path指向thing_controller中具有respond_to块的'create'方法:
respond_to do |format|
format.js
end
我在views / thing
中有一个create.js.erb文件我的布局文件中有以下javascript标记:
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag :defaults %>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
但是,当我发布表单时,日志会显示:
Processing by MyThingController#create as HTML
我得到一个空白页面(因为我在respond_to中没有format.html选项)
如何调用create.js.erb文件?