回形针 +头像
我找到了这个教程(http://www.coffeepowered.net/2009/02/15/graceful-degredation-using-gravatar-as-a-fallback-avatar-with-paperclip/)关于实现 gravatar作为回形针启用模型的默认图像,但在实现时我看到消息“[:format, :png]:Array 的未定义方法‘匹配’”。这篇文章有什么问题吗?
I've found this tutorial (http://www.coffeepowered.net/2009/02/15/graceful-degredation-using-gravatar-as-a-fallback-avatar-with-paperclip/) about implementing gravatar as default image to the paperclip-enabled model, but on implementing i see message "undefined method `match' for [:format, :png]:Array". Whats wrong in this article?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我更新了代码,以便您更容易理解和调试。
I've updated the code to make it easier for you to understand and debug.
请注意,在尝试此解决方案时,我收到以下错误:
我通过将行替换为来解决它
:
Note I got the following error when attempting this solution:
I solved it by replacing the line:
with
如果您仍然遇到问题,可以尝试 Avatar gem,它支持一系列不同的 Avatar 方法,包括 Paperclip 和 Gravatar。
注意:这是一个有点无耻的插件,因为我写了这个东西。
If you continue to have trouble, you could try the Avatar gem, which supports a chain of different Avatar methods, including both Paperclip and Gravatar.
NB: this is a bit of a shameless plug, since I wrote the thing.