Ruby on rails Heroku暂存中未显示Rails 6图像

Ruby on rails Heroku暂存中未显示Rails 6图像,ruby-on-rails,image,heroku,assets,ruby-on-rails-6,Ruby On Rails,Image,Heroku,Assets,Ruby On Rails 6,我正在Welcome Controller中定义一些背景图像,因此根据图像更改的视图,在local中可以工作,但在Heroku中部署时,它停止显示背景图像 该应用程序位于rails 6中,图像和图像都是从assets文件夹中获取的。 背景图像正在课程视图中加载 标题部分,其中我正在加载图像: <section style="background-image:url(<%= @background_image%>)" class="banner <%= 'short-ban

我正在Welcome Controller中定义一些背景图像,因此根据图像更改的视图,在local中可以工作,但在Heroku中部署时,它停止显示背景图像

该应用程序位于rails 6中,图像和图像都是从assets文件夹中获取的。 背景图像正在课程视图中加载

标题部分,其中我正在加载图像:

<section style="background-image:url(<%= @background_image%>)" class="banner <%= 'short-banner' unless @index%>" role="banner">


检查
env/production.rb

此行并使其
为真
并再次部署。让我知道

#config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.public_file_server.enabled = true
解决了! 更改标题:

<section style="background-image:url(<%= asset_path(@background_image)%>)" class="banner <%= 'short-banner' unless @index%>" role="banner">

访问
courses
url是否会显示图像?是的,其中一个显示,可能是因为在AWSdid中托管不起作用,出现在heroku控制台:2019-09-23T19:05:12.453510+00:00 heroku[router]:at=info method=GET path=“/assets/our_team.jpg”host=bogota-bootcamp-staging.herokuapp.com请求_id=e5aaedcc-801d-42b7-aa02-df6fd13e0f36 fwd=“181.48.147.210”dyno=web.1 connect=0ms服务=3ms状态=404字节=1781协议=https
<section style="background-image:url(<%= asset_path(@background_image)%>)" class="banner <%= 'short-banner' unless @index%>" role="banner">
 def index
    @background_image = 'computer_low_res.jpg'
    @title = 'BOGOTA BOOTCAMP'
  end

  def learn
    @background_image = 'two_computers_low_res.jpg'
    @title = 'Try some Ruby'
  end

  def courses
    @background_image = 'https://s3.us-east-2.amazonaws.com/bogota-bootcamp/about-program.jpg'
    @title = 'Courses'
  end