🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

acts_as_gravatar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acts_as_gravatar

bundlerRubyGems.org
Version
1.0.2
Version published
Maintainers
1
Created
Source

acts_as_gravatar

acts_as_gravatar provide simple access to gravatar from ActiveRecord. From the email columns (can set it optionally) such as devices, acts_as_gravatar generate a URL of gravatar.

Installation

Add this line to your application's Gemfile:

gem 'acts_as_gravatar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_gravatar

Usage

Basic

Call acts_as_gravatar in class of ActiveRecord::Base.

class User < ActiveRecord::Base
    acts_as_gravatar
end

The next method becomes to be usable.

user = User.find(1); #

# get profile url of gravatar.
user.gravatar_profile  # URL of gravatar profile.

# get image url of gravatar.
user.gravatar_image     # URL of gravatar image.

acts_as_gravatar read email column.(default)

Options

when call acts_as_gravatar, can set default values. (The option not to appoint at the time of acts_as_gravatar summons becomes the default of gravatar.)

class User < ActiveRecord::Base
  acts_as_gravatar({
    :column        => :email,                                # email column of Model.
    :default_image => nil,                                   # default_image.(URL or gravatar default image param.)
    :force_default => false,                                 # force the default image.
    :image_type    => ActsAsGravatar::Enums::ImageType::PNG, # image_type. (JPG/JPEG/GIF/PNG)
    :rating        => ActsAsGravatar::Enums::Rating::PG,     # rating. (G/PG/R/X)
    :secure        => false,                                 # secure protocol. (https).
    :size          => 80,                                    # image size.
  })
end

Please See Gravatar, Options of gravatar for more detail.

And can set options, when call gravatar_image or gravatar_profile.

user = User.find(1); #

# get image url of gravatar.
user.gravatar_image :secure => true, :size => 200

# get profile url of gravatar.
user.gravatar_profile :column => :other_column

API DOCUMENT

  • acts_as_gravatar

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

I have poor English. Please help meeeeeeeee!!!!

FAQs

Package last updated on 11 Dec 2013

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