# Fragment Cache Wackiness

**URL:** <https://www.ruby-forum.com/t/fragment-cache-wackiness/89720>\
**Category:** Rails\
**Created:** [March 29, 2006, 4:10am UTC](https://www.ruby-forum.com/t/fragment-cache-wackiness/89720 "2006-03-29T04:10:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ross\_Karchner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ross\_Karchner](https://www.ruby-forum.com/u/Ross_Karchner)\
**Post date:** [March 29, 2006, 4:10am UTC](https://www.ruby-forum.com/t/fragment-cache-wackiness/89720/1 "2006-03-29T04:10:17Z")

</div>

I can’t seem to get the fragment cache to use :file\_store. I’d really  
appreciate it if someone could point me in the right direction.

Rails 1.1 final, FreeBSD

Observe:

In environment.rb AND production.rb (for good measure, DRY be damned):

ActionController::Base.fragment\_cache\_store = :file\_store,  
“/www/apps/localfeeds/directory/tmp/fragmentcache/”

At the console prompt:

Loading production environment.

> > ActionController::Base.fragment\_cache\_store  
> > =\> #\<ActionController::Caching::Fragments::FileStore:0x8f81bac  
> > @cache\_path=“/www/apps/localfeeds/directory/tmp/fragmentcache/”\>

In a controller:

class ExportController \< ApplicationController  
before\_filter :locale\_finder  
caches\_action :rss, :opml, :top10opml  
…

Yet tmp/fragmentcache/ remains empty (and removing the directory or  
making it unwritable produces no errors in production.log)

I can tell by response times and watching production.log that it IS  
caching, so I can only assume it’s still using the default in-memory  
cache.

A potential wild-card is that I am using this plugin:  
[http://wiki.rubyonrails.com/rails/pages/Action+Cache+Update+Plugin](http://wiki.rubyonrails.com/rails/pages/Action+Cache+Update+Plugin)

So I tested without it. Same results.

Any ideas?

-Ross  
[http://rossnotes.com](http://rossnotes.com)

---

<div class="post-metadata">

**Author:** ![Ross\_Karchner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ross\_Karchner](https://www.ruby-forum.com/u/Ross_Karchner)\
**Post date:** [March 29, 2006, 5:44am UTC](https://www.ruby-forum.com/t/fragment-cache-wackiness/89720/2 "2006-03-29T05:44:47Z")

</div>

Solved!

The rdoc says:  
ActionController::Base.fragment\_cache\_store = :file\_store,  
“/path/to/cache/directory”

but, Agile…Rails says:

ActionController::Base.fragment\_cache\_store =  
ActionController::Caching::Fragments::FileStore.new(  
“#{RAILS\_ROOT}/tmp”)

I can confirm the Agile syntax works-- is this just a documentation bug?

-Ross

---

<div class="post-metadata">

**Author:** ![Ross\_Karchner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ross\_Karchner](https://www.ruby-forum.com/u/Ross_Karchner)\
**Post date:** [March 29, 2006, 6:14am UTC](https://www.ruby-forum.com/t/fragment-cache-wackiness/89720/3 "2006-03-29T06:14:31Z")

</div>

This is what I have in my environment.rb, within the Initializer.run  
block:

config.action\_controller.fragment\_cache\_store = :file\_store,  
“#{RAILS\_ROOT}/cache”

It worked with 1.0. I think it works with 1.1, but haven’t confirmed.

Joe
