I m new to rails. I m playing around with it on a SuSE 10.0 box with
ruby 1.8.2 and gems and rails and postgres. rails xyz creates a nice
rails application, with its directory and ruby script/server runs
webrick nicely and lets me see the page on localhost:3000.
I went with some tutorial to create a Hello page showing the time and a
Bye-Link to link to an Bye page.
class SayController < ApplicationController
@time = Time.now
cat app/views/say/hello.rhtmlHello Philipp Hello from Rails
It is <%= @time %>
Cu <%= link_to "Bye!", :action => "goodbye" %>
cat app/views/say/goodbye.rhtmlBye Philipp Going home
Time was <%= @time %>
It works without error. But in goodbye @time is always nil, empty, and
it doesnt matter if I play around with
config/environments/development.rb and change config.cache_classes from
false to true and back, nor if I run ruby script/server -c which should
cache the classes. In my understanding so far, @time in the goodbye
method should be the living alive instance variable of my living view
controller, right? It is living beyond the lifetime of the single
request?! So it should have the value from the hello method from the
invocation (and creation of the controller) before. But like I said,
whatever I m doing it is always nil.
What am I missing?