gpt4 book ai didi

ruby-on-rails - 头像不显示

转载 作者:行者123 更新时间:2023-12-04 03:43:35 24 4
gpt4 key购买 nike

我正在学习 Michael Hartl 的 Ruby on Rails 教程,并且添加了代码来显示用户的 Gravatar 图像。但它不显示。

这是我的用户助手

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

这是我的 show.html.erb

<% provide(:title, @user.name) %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>
</section>
</aside>
</div>

这是我检查元素时的代码

    <img alt="humber" class="gravatar" src="https://secure.gravatar.com/avatar/8e92292186fbb306e253b08d0f3eb993">
humber

this is the image

最佳答案

可能你做了教程中的一个练习并编写了自定义类来隐藏图像

img {
display: none;
}

关于ruby-on-rails - 头像不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38222989/

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