public
Description: Simple Hit Tracker for ActiveRecord Models
Homepage:
Clone URL: git://github.com/angelo0000/acts_as_hittable.git
name age message
file README Mon Sep 08 21:13:07 -0700 2008 first commit [angelo0000]
file Rakefile Mon Sep 08 21:13:07 -0700 2008 first commit [angelo0000]
file init.rb Mon Sep 08 21:13:07 -0700 2008 first commit [angelo0000]
directory lib/ Loading commit data...
directory tasks/
directory test/
ActsAsHittable
===============

This is a simple plugin to allow you to track any AR model. To use add the following line to your model:

class SomeModel < ActiveRecord::Base
  acts_as_hittable
end


Migration Needed

class CreateHits < ActiveRecord::Migration
  def self.up
    create_table :hits do |t|
      t.column :hittable_type, :string
      t.column :hittable_id, :integer
      t.timestamps
    end
        
    add_index :hits, [:hittable_type, :hittable_id]
  end

  def self.down
    drop_table :hits
  end
end

Example
=======
model.hit - creates a new tracking for your object
collection.hit - creates a new tracking for each object in collection
model.hit_count - number of hits on model

Copyright (c) 2008 Jake Dempsey, released under the MIT license