Caches_action, before_filter and globalize

Hi,

I’am trying to add caching to my application. I’m using Globalize for
internationalization so I need to run :before_filter to determine the
right language for display.

I tried adding lines like this to my controllers believing it would just
work

caches_action :index

but I get errors in my logs, the before filter does not run, and I don’t
understand why it should yield. Rails 1.2.1. Thank you for your help.

Processing FrontpageController#index (for 127.0.0.1 at 2007-01-20
02:30:33) [GET]
Session ID: ab1254f2b913ec8b524b414bbf90d274
Parameters: {“action”=>“index”, “controller”=>“frontpage”}
Fragment read: localhost:3003/index (0.00052)
Filter chain halted as
[#Proc:0x02534538@/Applications/Locomotive2/Bundles/rmagickRailsJan2007_x86.locobundle/framework/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:597]
did not yield.
Completed in 0.00513 (194 reqs/sec) | DB: 0.00000 (0%) | 200 OK
[http://localhost/]

This is my application.rb

class ApplicationController < ActionController::Base

Pick a unique cookie name to distinguish our session data from

others’
session :session_key => ‘_filipcic_session_id’

before_filter :set_locale

def set_locale
default_locale = ‘en-US’
accept_locales = LOCALES.keys
request_language = request.env[‘HTTP_ACCEPT_LANGUAGE’]
request_language = request_language.nil? ? nil :
request_language[/[^,;]+/]

@locale = params[:locale] || session[:locale] ||
          request_language || default_locale
session[:locale] = @locale
begin
  if accept_locales.include?(@locale)
    Locale.set @locale
  else
    Locale.set default_locale
  end
rescue
  Locale.set default_locale
end

end

end