visibility controller instance variables

Hi all,

class SomethingController < ApplicationController

  def action1     @instance_var = SomeClass.find(1)   end

  def action2     #...   end

end

It seems I have to assign @instance_var as well in action2, even I run through action1 earlier? If I don't assign it, @instance_var is nil in action2.rhtml.

Is my assumption correct or do I miss something?

Vince

Vince, assuming action1 does something and then renders to the browser then the answer to your question is "yes" but not perhaps in the way you were thinking.

The web being a stateless world, nothing is remembered after the end of your action1 (unless you take action to store some stuff that you can restore up again). Each request, action and response is brand new every time. Nothing of the last action, or any action is remembered.

Therefore at the start of action2 there is nothing remembered unless you took action to store and restore what you need.

Cheers, --Kip