在Rails 4.2.6中使用Sprockets :: Rails :: Helper :: AssetNotPrecompiled

时间:2018-03-08 18:55:22

标签: ruby-on-rails-4 sprockets rails-sprockets

我目前正在开发Rails Rails 4.2.6ruby 2.2.2p95。我收到以下错误。enter image description here

为什么资产在开发中没有预编译?我尝试添加gem 'sprockets-rails', '~> 3.0'但没有成功。我还尝试在development.rb中将config.assets.debug = true更改为false,但这也无效。样式位于assets文件夹中,如何解决此问题?

2 个答案:

答案 0 :(得分:0)

table { border-collapse: collapse; } table, th, td { border: 1px solid black; }中,更改

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="myTable">
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
      <th>Favorite Food</th>
      <th>Favorite Beer</th>
    </tr>
  </thead>
  <tbody>
    <tr class='tableRow'>
      <td>John</td>
      <td>30</td>
      <td><label><input type="radio" name="favoriteFood1" value="Pizza"/>Pizza</label><label><input type="radio" name="favoriteFood1" value="Tacos" />Tacos</label>
        <td><input type="text" class="favoriteBeer"></td>
    </tr>
    <tr class='tableRow'>
      <td>Joe</td>
      <td>25</td>
      <td><label><input type="radio" name="favoriteFood2" value="Pizza"/>Pizza</label><label><input type="radio" name="favoriteFood2" value="Tacos"/>Tacos</label>
        <td><input type="text" class="favoriteBeer"></td>
    </tr>
    <tr class='tableRow'>
      <td>Sam</td>
      <td>50</td>
      <td><label><input type="radio" name="favoriteFood3" value="Pizza"/>Pizza</label><label><input type="radio" name="favoriteFood3" value="Tacos"/>Tacos</label>
        <td><input type="text" class="favoriteBeer"></td>
    </tr>
  </tbody>
</table>
<button type="button">Retrieve Data</button>

如果是真的。

答案 1 :(得分:0)

很少纠正。使用assets代替assest

config.assets.debug = false