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
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