Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reinsch committed Jul 20, 2009
1 parent 69d4736 commit c4e8b11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
rdoc
*~
37 changes: 17 additions & 20 deletions README → README.rdoc
@@ -1,36 +1,33 @@
Acts As Rateble
=============
= Acts As Rateble

Acts_as_rateable is a plugin released under the MIT license.
It makes activerecord models rateable through a polymorphic association and optionally logs which user rated which model.
In this case, one user can rate an object once. Used on cotcot.hu for article rating, sponsored quizzes, etc.


Example
=======
= Example

Install the plugin into your vendor/plugins directory, insert 'acts_as_rateable' into your model, then restart your application.

class Post < ActiveRecord::Base

acts_as_rateable

end

Now your model is extended by the plugin, you can rate it ( 1-# )or calculate the average rating.

@post.rate_it( 4, current_user.id )
class Post < ActiveRecord::Base
acts_as_rateable
end

@post.average_rating #=> 4.0
Now your model is extended by the plugin, you can rate it (1-#) or calculate the average rating.

@post.average_rating_round #=> 4
@post.rate_it(4, current_user)

@post.average_rating_percent #=> 80
@post.average_rating #=> 4.0
@post.average_rating_round #=> 4
@post.average_rating_percent #=> 80
@post.rated_by?(current_user) #=> true
@post.rating_by(current_user) #=> 4

@post.rated_by?( current_user ) #=> rating || false

Post.find_average_of( 4 ) #=> array of posts
Post.find_average_of(4) #=> array of posts

See acts_as_rateable.rb for further details!

= Copyright

Copyright (c) 2007 Ferenc Fekete, http://xpnindustries.com , released under the MIT license

Copyright (c) 2009 mobalean LLC, http://www.mobalean.com
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -17,6 +17,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ActsAsRatable'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

0 comments on commit c4e8b11

Please sign in to comment.