gpt4 book ai didi

ruby-on-rails - rails : Gravatar images not showing up in Chrome

转载 作者:行者123 更新时间:2023-12-04 06:29:41 25 4
gpt4 key购买 nike

我正在研究 Michael Hartl 的 Ruby on Rails Tutorial ,并且我添加了代码来显示用户的 Gravatar 图像。它在 Firefox 和 Safari 中运行良好,但在 Chrome 中运行不佳(图像只是不显示)。

View :

#app/views/users/show.html.erb

<% provide(:title, @user.name) %>
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>

和助手:

#app/helpers/users_helper.rb

module UsersHelper

# Returns the Gravatar (http://gravatar.com/) for the given user.
def gravatar_for(user)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
end

这里有什么问题吗?

最佳答案

对我来说,我必须将 ( http://localhost:3000/ ) 添加到 Ghostery 的白名单网站才能解决同样的问题。

关于ruby-on-rails - rails : Gravatar images not showing up in Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21468969/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com