Coder Social home page Coder Social logo

gravtastic's People

Contributors

acant avatar achiurizo avatar bonsaiben avatar chrislloyd avatar crantok avatar gohanlon avatar jasoncheow avatar nyxelio avatar ryanscottlewis avatar tigerwolf avatar vadimpushtaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gravtastic's Issues

Error with Rails 3 and matthuhiggins-foreigner

I am using Rails 3 and have in my gemfile

gem 'matthuhiggins-foreigner', :require => 'foreigner'
gem 'gravtastic', '~> 2.2.0'

Then when I start my server, I get this error:

$ rails s
/Library/Ruby/Gems/1.8/gems/matthuhiggins-foreigner-0.6.4/lib/foreigner.rb:29:in `on_load': undefined method `config' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/base.rb:1867
from /Library/Ruby/Gems/1.8/gems/gravtastic-2.2.0/lib/gravtastic.rb:89
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:112:in `require'
from /Users/chad/Dropbox/Sites/pc/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

The offending line in gravtastic-2.2.0/lib/gravtastic.rb is

ActiveRecord::Base.send(:include, Gravtastic) if defined?(ActiveRecord) # :nodoc:

And in Foreigner is

ActiveRecord::Base.configurations = Rails.application.config.database_configuration

I don't know if Gravtastic or Foreigner is to blame here; if I comment out either from my Gemfile, the server starts up just fine. You can go over to mattuhiggin's foreigner to see the similar post that I left there.

I'd happily help fix it, but I'm new to this whole world of rails and I've never written a plugin, so I may need some guidance.

URL query string

def url_params_from_hash(hash)
  '?' + hash.map do |key, val|
    [self.class.gravatar_abbreviations[key.to_sym] || key.to_s, val.to_s ].join('=')
  end.sort.join('&')
end

This method of converting hash to url params is pretty naive. It's not going to work with, for instance, :default => 'Sex & Drugs & Rock & Roll'.

It's not really a problem in real life (so far), but it's possible to

  • Include some more powerful code (copying it from respected source).
  • Use external function, adding some dependency.
  • Forget about it.

What's your opinion, mr. Lloyd?

gravatar effective time

It this normal that my site using gravtastic takes almost one hour take effect showing the members' own avatar.
While the default avatar still holds. Thanks

Rails 4

Is the javascript Implemention still works on rails 4? because I'm have trouble using this.

//=require gravtastic

Add support for local default image

is_gravtastic :filetype => :jpg, :size => 60, :default => "/images/elements/anonymous.jpg"
is this possible? It only works if i type a whole url, which kind of breaks on your local development server

Auto-inclusion in Mongoid 2.0.0.beta breaks Mongoid

I'm guessing that the Mongoid::Document.included call overrides this one...? The end result is that Mongoid just breaks completely.

I am trying to see if I can find a way to work around this, but its not going well. I'm guessing this inclusion method works on the older (Rails 2.x) version of Mongoid without issue, but on the current pre-release version (2.0.0.beta.18 for Rails 3.x), it just doesn't. If there isn't a decent workaround for this, perhaps removing it might be best, and relying on a manual call from Mongoid document classes to include Gravtastic.

undefined method `gravatar_url' for nil:NilClass

I did everything the install says but I get this error...

undefined method `gravatar_url' for nil:NilClass
Extracted source (around line #9):

6: %p.post_body= post.body
7: %span.author
8: by
9: = image_tag @user.gravatar_url
10: = post.author.name
11: %span.published_on
12: on

Pedantic word usage correction

From the readme:

And wallah! It's exactly the same as with ActiveRecord!

I think you mean to say voila. Unless of course you're referring to "a person in charge of, employed at, or concerned with a particular thing" that is. :-)

setting default with relative (but *local*) path

gravtastic :size => 200, :default => "#{Rails.root}/public/images/default.png"

results in these sorts of silly URLs:

http://gravatar.com/avatar/1b84085019dc567bfaf60626a508be80.png?d=/Users/chad/Dropbox/Code/pc/public/images/photo.png

I get similarly silly results when trying without the Rails.root, of course.

I want my staging instance to use the photo stored at the staging instance, the dev instance to not need a network connection, etc. How do I do this?

Attempting to install the latest gravtastic gem on RubyGems 1.3.5 fails

When I try to install gravtastic (latest version) (Mac OS X 10.6.2) using RubyGems 1.3.5, the install fails as so:

danbookpro: daniel$ sudo gem install gravtastic
ERROR: While executing gem ... (NoMethodError)
undefined method `include?' for nil:NilClass

But if I try to install a previous version of the gem:

danbookpro: daniel$ sudo gem install gravtastic --version '=2.1.3'
Successfully installed gravtastic-2.1.3
1 gem installed
Installing ri documentation for gravtastic-2.1.3...
Installing RDoc documentation for gravtastic-2.1.3...

???

Wrong number of arguments for gravatar_options for gem version 2.1.1

Latest gem version simply does not work due to this error:

Profile.first.gravatar_url
ArgumentError: wrong number of arguments (1 for 0)
from /Library/Ruby/Gems/1.8/gems/gravtastic-2.1.1/lib/gravtastic.rb:74:in `gravatar_options'

The line below calls gravatar_options with a single argument, which it does not support.

[self.class.gravatar_options(key.to_sym) || key.to_s, CGI::escape(val.to_s) ].join('=')

def gravatar_options
  {
    :size => 's',
    :default => 'd',
    :rating => 'r'
  }
end

Return nil if no avatar

Cheers for the plugin. Would be great to receive nil if the user doesn't have an avatar on gravatar, so that we can supply our own default or alternative, rather than just displaying the gravatar default.

gravatar_url is escaped in Rails 3.0.0

if I use image_tag user.gravatar_url(:size => 32, :default => 'mm'), I will get the image tag with

<img src="http://gravatar.com/avatar/13c60e2a5806406b537daa542d3495da.png?d=mm&amp;r=PG&amp;s=32" >

but it should be

<img src="http://gravatar.com/avatar/13c60e2a5806406b537daa542d3495da.png?d=mm&r=PG&s=32">

mongomapper support

After upgrading to version 2.2.0, I am still unable to get this working with mongo mapper. Suggestions?

/opt/local/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.10/lib/mongo_mapper/dynamic_finder.rb:32:in method_missing':NoMethodError: undefined methodis_gravtastic!' for User:Class

Ampersand encoding causes HTML validation failure

The ampersands in the Gravatar URLs should be encoded as &amp; instead of just &. At the moment the unencoded ampersands cause the HTML to fail to validate.

Line 75 should be:

end.sort.join('&amp;')

Couldn't be much simpler to change. Hope this is helpful!

Support caching the URL into the database

Please support caching the URL into the database.

I would like to have a column where the gravatur_url with standard option is saved and when calling gravatar_url without options it will be returned the value from database, when calling with options, just append the modifators to the string from the database.

NoMethodError: undefined method `merge' for nil:NilClass

Just trying to get gravtastic working today with
Rails 3.0.7
gravtastic (3.1.0)
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]

I have the following model:

class User < ActiveRecord::Base
include Gravtastic
has_gravatar
devise :database_authenticatable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
.
.
.
end

When I try the following in the console:
u = User.first
u.gravatar_url

I get:

NoMethodError: undefined method merge' for nil:NilClass from /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/whiny_nil.rb:48:inmethod_missing'
from /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/gravtastic-3.1.0/lib/gravtastic.rb:77:in gravatar_url' from (irb):2 from /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:44:instart'
from /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in start' from /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:23:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

I am sure it is something in my setup, so I apologize in advance for taking your time with this, but I am at a loss.

Tom

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.