Rails .where对数据库的调用显示开发中的图像(mysql),但不显示生产中的图像(postgres)

问题描述 投票:1回答:1

在开发中的视图上运行以下命令时,图像会完美加载。 但是,当我将所有内容推送到Heroku生产中时,它们不会出现。 我知道我的AWS映像不是问题,因为我可以使用@image实例变量在应用程序的其他位置调用它们。 这与使用不同类型的Rails调用的Postgres有关系吗?

<% if @location.brand.images.where(image_category: 'logo').take %> 
    <span class="logo-title brand-logo"><img src="<%= @location.brand.images.where(image_category: 'logo').first.image.logo %>"></span>
<% else %>
    <span class="logo-title"><%= @location.brand.brand_name %></span>
<% end %>
mysql ruby-on-rails postgresql heroku
1个回答
1
投票

可能有太多事情,所以对该问题的真正答案是:更改开发环境以也使用Postgres。

MySQL和Postgres之间的最大区别之一是MySQL默认情况下不区分大小写,而Postgres区分大小写。 您的字符串"logo"在您的数据库中是否可能与众不同?

© www.soinside.com 2019 - 2024. All rights reserved.