Help implementing page caching in Rails 3 app served from a subdirectory via Passenger/Apache -


I am serving a Rail 3 application with a subdirectory with Passenger and Apache:

  & lt; Virtualhost * *: 80 & gt; Rackby URI / streamspans & lt; Directory / var / www / html / streamspons & gt; Allow all options - Multi-view & lt; / Directory & gt; & Lt; / VirtualHost & gt;   

I cache a page in my controller:

  caches_page: banner   

when # banner action The page is written on public /, but inside the other directory named for the app's subdirectory (in other words, the entire request including the subdirectory is in the string cache path):

  "receive /streamspons/decks/2/banner.js" ... ... page / var / www / public / apps / streamspons / releases / 20110316162902 / public / streamspons / decks / 2 / Write banner. JS   

When this action is requested again, the cache is remembered and it works again because the cached page public / decks / 2 / banner .js should be at "post-text" itemprop = "text">

In Rail 3.0.1, I got it in my app / controllers / application_controller. Rb was added:

  class ApplicationController & lt; ActionController :: Base ... # path path # path path request path path to self.page_cache_path (path) path.gsub from path def! (% R [^ / streamspons], "") Page_mart-directory + Page_cache_file (path) End of the end   

In the latest train, this looks like this:

  Class ApplicationController & lt; ActionController :: Base ... def self.page_cache_path (path, extension = nil) path.gsub! (% R [^ / streamspons], "") Page_caatch_directory + page_cache_file (path, extension) end and    

Comments