This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
| |
README.textile | Fri Jul 18 20:42:02 -0700 2008 | [zachinglis] |
| |
Rakefile | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
| |
generators/ | Fri Jul 18 15:08:57 -0700 2008 | [zachinglis] |
| |
init.rb | Thu Jul 17 11:02:00 -0700 2008 | [zachinglis] |
| |
install.rb | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
| |
lib/ | Mon Jul 21 06:58:22 -0700 2008 | [zachinglis] |
| |
tasks/ | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
| |
test/ | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
| |
uninstall.rb | Thu Jul 17 08:50:36 -0700 2008 | [zachinglis] |
README.textile
is_rateable
Currently star buttons are a put request, not a post request like they should be due to time constraints. Should be fixed in a future version.
Patches welcome! I do test my own stuff but until I find a nice and easy way to include rspec in plugins, they won’t come with the specs.
Usage
To install, type script/generate rateable
is_rateable :upto => 5 # it defaults :upto => 5
In your view.
render_rating(@book, :interactive_stars)
render_rating(@book) # If you want to also see 1/5 Stars
If a user rates more than twice, it will delete their older rating and put up a new rating.
Add a method to your books_controller like so:
def rate
@book = Book.find(params[:id])
unless @book.add_rating(params[:rating].to_i, :ip => request.remote_ip)
flash[:notice] = "You have already voted on this book"
end
redirect_to @book
end
Todo
- Annotate methods
Credits
- Zach Inglis
- Nathan Arnold
- Tim Pope
- Rogie King – CSS for Stars
- Some code from restful_authentication by Rick Olson
Copyright© 2008 Zach Inglis, released under the MIT license





