# Session Variable in Application.rb

**URL:** <https://www.ruby-forum.com/t/session-variable-in-application-rb/151774>\
**Category:** Rails\
**Created:** [October 25, 2008, 1:14pm UTC](https://www.ruby-forum.com/t/session-variable-in-application-rb/151774 "2008-10-25T13:14:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 25, 2008, 1:14pm UTC](https://www.ruby-forum.com/t/session-variable-in-application-rb/151774/1 "2008-10-25T13:14:06Z")

</div>

I’m having a problem referencing the session variable from a class  
within the application.rb file.

undefined local variable or method `session’ for #\<Turnrun:  
0x2abc20195440 @runreport=[], @turnstotake=“5”\>

I’m not sure what i’m doing wrong or why this error would occur…does  
anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 25, 2008, 2:27pm UTC](https://www.ruby-forum.com/t/session-variable-in-application-rb/151774/2 "2008-10-25T14:27:52Z")

</div>

On Oct 24, 11:57 pm, removed\_email\_address@domain.invalid wrote:

> I’m having a problem referencing the session variable from a class  
> within the application.rb file.
> 
> undefined local variable or method `session’ for #\<Turnrun:  
> 0x2abc20195440 @runreport=[], @turnstotake=“5”\>
> 
> I’m not sure what i’m doing wrong or why this error would occur…does  
> anyone have any ideas?

Sounds like you’re calling session from an object other that the  
controller. That doesn’t work. showing a little more code might allow  
a more informative answer.

Fred
