Socket
Book a DemoInstallSign in
Socket

to_gravatar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to_gravatar

1.0.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

to_gravatar

To install… add the following to your Gemfile:

gem ‘to_gravatar’

…and run ‘bundle install’.

Then, simply add “has_gravatar” to any model with an :email property. Optionally, you may pass in some other property name which includes the email address… something like:

class User < ActiveRecord::Base

attr_accessible :some_other_field, :password, :password_confirmation, :remember_me

has_gravatar :field => "some_other_field"

end

In your views… @user.to_gravatar will return the url to the user’s Gravatar. So you can do something like:

image_tag @user.to_gravatar

You can also add options for the size, default image, rating restriction, ssl. Example:

class User < ActiveRecord::Base

attr_accessible :some_other_field, :password, :password_confirmation, :remember_me

has_gravatar :field => "some_other_field", ### field containing email address. default to :email. :default => "http://example.com/example_image.jpg", ### url of default image :rating => "g", ### options are "g", "pg", "r", and "x". default to "r". :size => 100, ### pixels square. default to 80px. :ssl => true ### use https, avoid popups. defaults false. end

FAQs

Package last updated on 22 Apr 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.