开发者

Rails Caches_Page being misplaced due to namespacing

I have a controller w开发者_JAVA技巧ithin a namespace and would like to cache it's Index. I am successfully caching pages that are not under a namespace, and successfully caching fragments as well.

When I visit http//.../house/kitchen it successfully creates /public/house/kitchen.html. However it never finds it, so it is always writing over the cached file.

I haven't been able to find an option with cache_page or caches_page to help me direct the cached file in the correct location.

Another frustrating thing is that http//.../house/kitchen/table successfully reads and creates /public/houose/kitchen/table/new.html.

I would greatly appreciate any direction!

Edit: adding details

Ruby : 1.8.7

Rails: 2.3.5

Server: Mongrel

Edit: I've placed kitchen.html in every possible location in my public folder, this controller seems just to refuse reading it.


My suggestion is to not use namespaces, anything you want to do in regards to urls can be done with routing. Is there a reason why you have to use namespaced controllers?


I am not sure if it is relevant but I found there was an issue with goldspike web server a while ago.
So maybe your web server also is missing something (BTW, what a web server are you using)?


I think I'm having the same issue. If so, I know the cause, but haven't yet found a solution.

The web server finds the directory http://…/house/kitchen/ before it finds the file http://…/house/kitchen.html. This directory doesn't contain an index.html, so it passes the route to Rails which kindly generates a new file.

So, you could:

  1. Place your cached file at http://…/house/kitchen/index.html

  2. Tell your web server to look for *.html files before it looks for */ directories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜