README.textile in gravtastic-1.7.1 vs README.textile in gravtastic-2.0.0
- old
+ new
@@ -10,21 +10,25 @@
Somewhere in your application you need to @require 'gravtastic'@. In Rails >= 2.1 you can forego this and just add a dependency gem dependency for Gravtastic.
config.gem 'gravtastic'
-The next step is to give your model a Gravatar:
+If you are using Merb & DataMapper you can add do the same by adding the following to your init.rb file:
+ dependency 'gravtastic'
+
+Make sure you add this after either the @use_orm :datamapper@ line or after a DataMapper extension. The next step is to give your model a Gravatar:
+
class User
- has_gravatar
+ is_gravtastic
end
-If you are using a standard Ruby class or Datamapper resource you have to add the line @include Gravtastic::Model@ before @has_gravatar@.
+If you are using a standard Ruby class you have to add the line @include Gravtastic::Resource@ before @is_gravtastic@.
This defaults to looking for the gravatar ID on the @email@ method. So, if your @User@ has an @email@ then it will send that to Gravatar to get their picture. You can change the default gravatar source like this:
- has_gravatar :on => :author_email
+ is_gravtastic :with => :author_email
Now, you can access your object's gravatar with the @gravatar_url@ method:
current_user.gravatar_url
=> "http://gravatar.com/e9e719b44653a9300e1567f09f6b2e9e.png?r=PG"
@@ -37,12 +41,12 @@
current_user.gravatar_url(:secure => true)
=> "https://secure.gravatar.com/e9e719b44653a9300e1567f09f6b2e9e.png?r=PG"
However, to DRY things up you can specify defaults in the class declaration.
- has_gravatar :author_email, :defaults => { :rating => 'R18', :size => 20 }
+ is_gravtastic :with => :author_email, :rating => 'R18', :size => 20
-Nice, now all the calls to gravatar_url will have the defaults you have specified.
+Nice, now all the calls to gravatar_url will have the defaults you have specified. Any options that you pass when you use @gravatar_url@ will over-ride these class-defaults.
PS. Bonus points for anybody who can tell me what that users email is!
h2. Authors