Rails caches_page: index in the wrong place

I have a project controller in my Rails application with:

caches_page :index

However, instead of the cached file generated in /public/projects/index.html, it is in /public/projects.html.

The web server (currently Mongrel) searches directories */for *.htmlfiles. Thus, the request is http://…/projectsrouted through Rails, and my index cache file is never served.

How can I say caches_page :indexto generate a file with /public/projects/index.htmlinstead?

+3
source share
1 answer

You can specify the directory by adding the following to your environment.rb configuration block

config.cache_store = :file_store, "#{RAILS_ROOT}/public/projects" 

A couple of other things:

  • Rails, , ,

  • , , , - ( ).

0

Source: https://habr.com/ru/post/1740765/


All Articles