[Rails] caching compiled templates

A

Andreas Schwarz

Hi,

I'm using the following code for template caching in Rails:
http://codepaste.org/view/paste/188

This basically works, but there is one problem. Example:

Controller:
class SomeController
def a
@var = "action a"
end

def b
@var = "action b"
end

def c
# don't set @var
end
end

View:
<%= @var %>

When I call the action a I get the result "action a".
When I call the action b I get the result "action b".
No surprise so far.
But when I call the action c, which doesn't set @var, I don't get "",
instead I get whatever the value of @var was in the action that was
called before c. So if I call a,c I get two times "action a", if I call
b,c I get two times "action b".

Any idea how this problem could be solved?

Thanks
Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top