Agile Web Development

Build it. Launch it. Love it.

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 Tag_red
Rating (48 votes)
Owner Damian Martinelli
Created 12 February 2008

Comments

  • Avatar
    Michael
    4 June 2008

    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

  • Avatar
    27 June 2008

    Thanks Michael. I updated the svn with this changes.

  • Jeff
    9 December 2008

    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 :)

Add a comment