我正在关注rails casts#340以在我的应用程序中实现数据表。找不到文件'dataTables/jquery.dataTables'Rails 4
以下所有步骤,我得到这个错误: 找不到文件“数据表/ jquery.dataTables”
我使用的轨道4,我发现了一些教程,我不得不提到的文件创建像application.css和products.js.coffee
的Gemfile
gem 'jquery-rails'
group :assets do
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem 'jquery-ui-rails'
end
的application.js
//= require jquery
//= require dataTables/jquery.dataTables
//= require_tree .
Application.js.coffee
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require dataTables/jquery.dataTables
*= require_tree .
*/
并且是轨道4我已经添加了调用样式表在/layouts/application.html.erb
<%= stylesheet_link_tag 'application.css', media: 'all' %>
和产品/ index.htm.erb
<table class="table table-normal" id="products" >
<thead>
<tr>
<td>Code</td>
<td>Name</td>
<td>Description</td>
<td>Price</td>
<td>Stock</td>
<td>Enabled</td>
<td>Company</td>
</tr>
</thead>
<tbody>
<% @products.each do |product| %>
<tr>
<td style="text-decoration: underline;"><%= link_to product.code, edit_product_path(product) %></td>
<td><%= product.name %></td>
<td><%= product.description %></td>
<td><%= product.price %></td>
<td><%= product.stock %></td>
<td><%= product.enabled %></td>
<td><%= product.company_id %></td>
</tr>
<% end %>
</tbody>
</table>
我得到这个错误在输出
找不到文件'dataTables/jquery.dataTables' (in .... app/assets/stylesheets/application.css:6)
任何想法如何解决这个问题? 在此先感谢
我采取了简单的方法,将css和js从gem直接复制到资产/样式表和资产/ javascript文件夹中......我对“无法找到文件”错误没有多少耐心! – Danny