ruby-on-rails – 我应该如何检查是否存在gravatar?

栏目: Ruby · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/11582395/how-should-i-check-if-gravatar-exist

使用这个宝石

https://github.com/sinisterchipmunk/gravatar

我如何检查指定电子邮件的格式是否存在?我想我错过了一些强制默认选项?因为这

url = Gravatar.new("generic@example.com").image_url

总是回来一张照片

看一下gem的文档,听起来你需要一个API密钥才能运行exists方法:
Fine, but how about the rest of the API as advertised at en.gravatar.com/site/implement/xmlrpc? Well, for that you need either the user’s Gravatar password, or their API key:
api = Gravatar.new(“generic@example.com”, :api_key => “AbCdEfG1234”)
api.exists?(“another@example.com”) #=> true or false, depending on whether the specified email exists.

如果用户没有gravatar,将根据电子邮件为他们生成图像(至少这是我的经验).我使用了gem gravatar_image_tag – http://rubygems.org/gems/gravatar_image_tag ,它可以让你更改默认的gravatar图像.

翻译自:https://stackoverflow.com/questions/11582395/how-should-i-check-if-gravatar-exist


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Distributed Algorithms

Distributed Algorithms

Nancy A. Lynch / Morgan Kaufmann / 1996-3-15 / USD 155.00

In "Distributed Algorithms", Nancy Lynch provides a blueprint for designing, implementing, and analyzing distributed algorithms. She directs her book at a wide audience, including students, programmer......一起来看看 《Distributed Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码