# visibility controller instance variables

**URL:** <https://discuss.rubyonrails.org/t/visibility-controller-instance-variables/16706>\
**Category:** rubyonrails-talk\
**Created:** [August 7, 2007, 1:24pm UTC](https://discuss.rubyonrails.org/t/visibility-controller-instance-variables/16706 "2007-08-07T13:24:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@Vince](https://discuss.rubyonrails.org/u/Vince)\
**Post date:** [August 7, 2007, 1:24pm UTC](https://discuss.rubyonrails.org/t/visibility-controller-instance-variables/16706/1 "2007-08-07T13:24:23Z")

</div>

Hi all,

class SomethingController \< ApplicationController

&nbsp;&nbsp;def action1 &nbsp;&nbsp;&nbsp;&nbsp;@instance\_var = SomeClass.find(1) &nbsp;&nbsp;end

&nbsp;&nbsp;def action2 &nbsp;&nbsp;&nbsp;&nbsp;#... &nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![Kip](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@Kip](https://discuss.rubyonrails.org/u/Kip)\
**Post date:** [August 7, 2007, 3:29pm UTC](https://discuss.rubyonrails.org/t/visibility-controller-instance-variables/16706/2 "2007-08-07T15:29:04Z")

</div>

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
