Rails History Plugin

Posted by Daniel Butler Thu, 01 Jun 2006 20:48:00 GMT

Belgian Damien Merenne has announced a plugin for Ruby on Rails that allows you to programatically keep track of a user’s browsing history in your controllers.

Once enabled, you can use the following methods in your actions:

  • last_location: returns the last visited location, can be used with one numeric argument precising how many locations to go back in the history (1 by default),
  • redirect_back: redirect the user to the last location in history, it takes the same arguments as last_location,
  • store_location: force storing of the current location in the history.

And it’s simple enough to use. Just add a bit of code like this to your controllers:

class ApplicationController < ActionController::Base
  history :default => "http://default.url.com/", 
          :max => 10
end

Read about the Rails History Plugin

Posted in  | Tags  | no comments

Sponsored Links

Sponsored Links

Comments

(leave url/email »)

   Comment Markup Help Preview comment