Links
Acts as Viewed
Categories
Acts as Viewed
This is a rails plugin that implements a view count system for ActiveRecord models. The views are only counted one time by IP address or User. Efficient SQL, configurable options and ready to run migrations.
Vitals
| Home | http://rubyforge.org/projects/acts-as-viewed/ |
|---|---|
| Repository | svn://rubyforge.org/var/svn/acts-as-viewed/trunk |
| License | Rails' (MIT) |
| Tags |
|
| Rating | (48 votes) |
| Owner | Damian Martinelli |
| Created | 12 February 2008 |
Comments
-
Great Plugin.
To get it running with mySQL and Rails 2.0 you have to change the follwoing lines.
Remove: return viewings.count(["viewer_id = '#{viewer.id}' or ip = '#{ip}'"]) > 0
Insert: return viewings.count(:conditions=>"viewer_id = '#{viewer.id}' or ip = '#{ip}'") > 0
Remove: return viewings.count(["ip = '#{ip}'"]) > 0
Insert: return viewings.count(:conditions=>"ip = '#{ip}'") > 0
-
Thanks Michael. I updated the svn with this changes.
-
Is it possible to use this plugin without a Users model, for instance, just to monitor views?
I have used it many times, only with a users model, and can't seem to make it work now without one :)

