【发布时间】:2020-01-23 18:49:28
【问题描述】:
我在 Welcome Controller 中定义了一些背景图像,因此根据图像更改的视图,在本地工作但当我在 Heroku 中部署时,它停止显示背景图像。
应用程序位于 rails 6 中,图像并从 assets 文件夹中获取。 背景图片正在课程视图中加载
标题部分,我正在加载图像:
<section style="background-image:url(<%= @background_image%>)" class="banner <%= 'short-banner' unless @index%>" role="banner">
欢迎控制器:
def index
@background_image = '/assets/computer_low_res.jpg'
@title = 'BOGOTA BOOTCAMP'
end
def learn
@background_image = '/assets/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
【问题讨论】:
-
访问
coursesurl,是否显示图像? -
是的,一个节目,可能是因为托管在 AWS 中
标签: ruby-on-rails image heroku assets ruby-on-rails-6