I have a set of largely static pages which I'd be happy to page cache for relatively long periods apart from the fact that their layout includes a much more dynamic header.
The most promising idea so far seems to be using action caching without layout :-
class SomethingController < ApplicationController
caches_action :index, :layout => false
end
Then at least the main content of the page is cached. Does that make sense?
Or would I be better off doing something else, e.g. fragment caching, server-side include, etc...?
What I have done is use page caching, and then make an AJAX call to fetch either:
Also, if you are just looking to include the users name, a better way exists. Simply store their name in a cookie and then use javascript to display it in the header. With no cookie, show a link to go login or register.