为了使用gravatar,我遵循了Railscast教程,它为我工作,但是如果默认图像它没有显示它,我的代码的错误是什么?
def avatar_url(user)
default_url = "#{root_url}images/user_avatar_small.png"
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
end另外,如果使用"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}",默认图像没有显示,我使用的是设计宝石。
我检查了浏览器检查器我发现了这个错误GET http://i0.wp.com/localhost/images/user_avatar_small.png 404 (Not Found)
发布于 2013-11-26 07:30:51
我想这是因为你的应用程序中缺少主机配置。
如何做到这一点有不同的选项:How do I configure the hostname for Rails ActionMailer? How do I set default host for url helpers in rails?
https://stackoverflow.com/questions/20207009
复制相似问题