A Rails 3 plugin for tracking anonymous users with cookies and IP.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

AnonymousUser
=============

This generator will create an AnonymousUser model. You can call AnonymousUser::get(request.remote_ip, cookies)
in a controller to get an AnonymousUser instance for the current user. The instance is based on IP of the remote
client OR cookie. If a user hasn't got a cookie but his IP is already assigned to an AnonymousUser, the get
method will return that user. If a user has a cookie but the IP is not yet assigned, the get method will return
the user with the cookie value. A new user is automatically created when there is no existing user with this IP
or cookie value.


Example
=======

Install plugin with

  rails plugin install git://github.com/mrbrdo/anonymous_user.git
  
Use the generator

  rails g anonymous_user
  
Migrate the database

  rake db:migrate

This plugin was created to allow anonymous rating with Ajaxful Rating plugin. For example you could add this to
your application controller

  helper_method :current_user
  
  def current_user
    AnonymousUser::get(request.remote_ip, cookies)
  end


Copyright (c) 2010 Jan Berdajs, released under the MIT license