In the application_controller application, you can add something like this:
class ApplicationController < ActionController::Base before_filter :store_history private def store_history session[:history] ||= [] session[:history].delete_at(0) if session[:history].size >= 5 session[:history] << request.url end end
Now it stores the last five pages visited.
source share