【问题标题】:Heroku: asset pipeline error to display imagesHeroku:显示图像的资产管道错误
【发布时间】:2019-04-04 12:01:13
【问题描述】:

我无法解决在 `assets/images in production(Heroku) 中显示图像的问题。图像在开发中显示,但仅在生产中不起作用。

ActionView::Template::Error(资产“category-1.jpeg”不在资产管道中。)

      <%= link_to category do %>
        <div class="categoryItem">
          <div class="image">
            <%= image_tag "category-#{category.id}.jpeg" %>
          </div>
          <div class="name">
            <span><%= category.name %></span>
          </div>
        </div>
      <% end %>

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    您可以通过在config/environments/production.rb 中更新production.rb 来克服这个问题。设置好了

    config.assets.compile = true
    

    【讨论】:

      猜你喜欢
      • 2016-02-10
      • 2012-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多