Вы хотите сохранить состояние истории AJAX. Два удивительных руководства по Rails и Javascript можно найти здесь:
http://railscasts.com/episodes/246-ajax-history-state
http://railscasts.com/episodes/175-ajax-history-and-bookmarks
Первая ссылка будет ссылаться на вторую.
с сайта Райана Бэйта | Railscasts.com
/* application.js */
if (history && history.pushState) {
$(function() {
$("#products th a, #products .pagination a").live("click", function(e) {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
e.preventDefault();
});
$("#products_search input").keyup(function() {
$.get($("#products_search").attr("action"), $("#products_search").serialize(), null, "script");
history.replaceState(null, document.title, $("#products_search").attr("action") + "?" + $("#products_search").serialize());
});
$(window).bind("popstate", function() {
$.getScript(location.href);
});
});
}
/* products/index.js.erb */
$("#products").html("<%= escape_javascript(render("products")) %>");
document.title = "<%= escape_javascript("#{params[:search].to_s.titleize} Products by #{(params[:sort] || 'name').titleize} - Page #{params[:page] || 1}") %>";