# Inconsistent behavior of caches\_page method

**URL:** <https://www.ruby-forum.com/t/inconsistent-behavior-of-caches-page-method/125461>\
**Category:** Rails\
**Created:** [January 9, 2008, 9:29am UTC](https://www.ruby-forum.com/t/inconsistent-behavior-of-caches-page-method/125461 "2008-01-09T09:29:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@Jason\_Y](https://www.ruby-forum.com/u/Jason_Y)\
**Post date:** [January 9, 2008, 9:29am UTC](https://www.ruby-forum.com/t/inconsistent-behavior-of-caches-page-method/125461/1 "2008-01-09T09:29:03Z")

</div>

ruby version : 1.8.6 rails version : 2.0.2 os : ubuntu 7.10

class StoreController \< ApplicationController

```
caches_page :index

def index

    do something

end

def expire

    expire_page :controller=>'store', :action=>'index'

end

```

end

when i visit: [http://localhost:3000/store](http://localhost:3000/store), a “RAILS\_ROOT/public/  
store.html” will appear

as i visit: [http://localhost:3000/store/index](http://localhost:3000/store/index), a “RAILS\_ROOT/public/  
store/index.html” will appear

the expire method in my class will delete the file “RAILS\_ROOT/public/  
store.html”

the problem is: {:controller=\>‘store’,:action=\>‘index’ }—\>url\_for  
method-----\>‘/store’ ,so expire\_page will delete the file  
store.html.

if i don’t use index action, it will not be a problem, but, anyone  
have better idea? thanks for the reply.
