Here's my case:
Using a link_to popup window to show a related help file of an element
on a page.
The problem:
Window pops up perfectly, but refuses to carryover @instance variables
in the controller that I referenced in the link_to command.
The tests:
- I have the right controller/class, because it renders a specific
template, which is what it does.
- I have the right template/view, because it reflects all of the html
and content--other than the variables.
- I instantiated @time = Time.now in the controller-class, but @time
in the view does not show up. If I simply call <%= Time.now %> -- it
works, but this does explain why the controller is not sending the
variables.
I am stumped!?!?!? Any insightful soul with an answer???
The fact that it's a popup changes nothing: as far as rails is concerned these are 2 completetly separate requests.
Fred
Is it possible the javascript negates the variables?
Here is my code..
Not at all. Javascript runs on the client and the client never sees
ruby variables. You need to set @helpy before you render the template:`
def funny
@helpy = Help.find(:first)
render :layout => false``
end`
-Bill
yachtman wrote:
And if I replace the
@helpy = Help.find(:first) [in the controller and the following
from the view] @helpy.content
which might be a database problem, with simply
@time = Time.now ...and ... @time
The popup generates fine with no errors, but there is no output for
the variable--its blank!
Bill,
Thanks a kazillion! Your help is most appreciated. Totally makes
sense--can't believe that I missed the logic. Sometimes (and usually
most of the time), it's staring right at you.
Finally back to some productive work.