Forum: Ruby on Rails Rails 3 refuses to clear the cache

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Cyril Lavedrine (Guest)
on 2012-01-19 12:17
(Received via mailing list)

I've recently migrated my application to Rails 3, and I encounter
with the new system of SQL-caching.

I have a 'category' action on my PostsController that I access through a
standard *:controller/:action/:id* route (, and runs a query to find posts
tagged with my parameter using the plugin
*acts_as_taggable_on_steroids* : *@posts
= Post.find_tagged_with(params[:id])*

When I restart the server, the query looks like this in my logs :
Post Load (0.2ms)  SELECT DISTINCT medias.* FROM `medias` INNER JOIN
taggings medias_taggings ON medias_taggings.taggable_id = AND
medias_taggings.taggable_type = 'Media' INNER JOIN tags medias_tags ON = medias_taggings.tag_id WHERE `medias`.`type` IN
AND (( LIKE 'something'))

... which is perfectly correct.
But when I actualize the page, the query is loaded from cache without
parameters and looks like this in the logs :
Post Load (0.7ms)  SELECT `medias`.* FROM `medias` WHERE `medias`.`type`

... so I get many results that aren't correct.
I've seen people getting around this problem with the 'uncached' block :
*Post.uncached do
    @posts = Post.find_tagged_with(params[:id])

This solution doesn't work on my application, I still get the correct
result only on the first page load. I even tried to force the query by
calling Rails.logger.debug @posts inside the block, to no avail.
I've read that appending '.all' to the call can force the query too, but
find_tagged_with returns an Array, not a Relation, and '.all' isn't
on Arrays.

What am i missing ? Don't hesitate to ask if I'm unclear, as I'm not a
native English speaker.

Thank you for your help
Cyril Lavedrine (Guest)
on 2012-01-23 09:28
(Received via mailing list)

For your information, I found a solution to my problem : I removed my
plugin acts_as_taggable_on_steroids and installed acts_as_taggable_on,
which is fully functionnal under Rails 3, and doesn't have the
apparently-not-so-well-known cache problem of the other one.


2012/1/19 Cyril Lavedrine <>
This topic is locked and can not be replied to.