Hi folks -
Seeing a weird problem and would love some help. It's documented in
http://pastie.org/278310 to be more readable.
In short, I have a
caches_page "action", :if => {stuff}
but the :if is never being called - the action is just caching every
time. (If I put a debugger call in the :if block, it never stops.)
If I replace caches_page with caches_action, the if evaluates
correctly.
There are before_filters in the controller, but they do not apply to
this action. (There's one in the supercontroller but it seems
similarly irrelevant - just trims www. from URLs.)
What am I missing? Did I uncover an :if bug (which I doubt) or am I
misunderstanding?
Full example (also in pastie):
#In this case, the :if is ignored, and all pages cache
class PagesController < ApplicationController
caches_page :show, :if => Proc.new {|c| ["home", "something-
else"].index(c.request.path_parameters["id"])}
before_filter :admin_required, :only =>
[ :index, :new, :create, :delete, :edit, :update ]
before_filter :IP_restricted, :only =>
[ :index, :new, :create, :delete, :edit, :update ]
#In this case, the :if executes correctly
class PagesController < ApplicationController
# just changing caches_page to caches_action works
caches_action :show, :if => Proc.new {|c| ["home", "something-
else"].index(c.request.path_parameters["id"])}
before_filter :admin_required, :only =>
[ :index, :new, :create, :delete, :edit, :update ]
before_filter :IP_restricted, :only =>
[ :index, :new, :create, :delete, :edit, :update ]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---