Forum: Ruby on Rails Re: session error in rails 1.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Christopher Burnley (Guest)
on 2006-04-06 04:15
(Received via mailing list)
I'm not sure if this is correct or will help, but I ran into a
problem after the 1.1 on my production server (FreeBSD 6.0, Apache2,
fast_cgi) where I would get an "application error". It took me a
while to figure out that the objects I was storing in the session
objects were coming back nil when accessed within a view. I did the
usual job of deleting the RUBY.Session objects in the temp directory,
bounced the web server and the problem was still there. I started to
think maybe there was an issue of scope with respect to the session
objects.

In my code I had previously stored things in the session by typing:
session[:xyz]= "blah"
and everything worked, then I upgraded to 1.1 and started getting the
errors. I went in and refactored all the session[:xyz] references to
@session[:xyz]= "blah"
bounced the server and everything worked like a charm. The strange
thing was that this only affected production. I could load the
console or webrick and everything behaved as expected which is why I
am not certain if the problem somehow magically got fixed between
server bounces but it is worth trying if you are having the same
problem.

Regards,
Chris Burnley
Craig W. (Guest)
on 2006-04-06 06:16
(Received via mailing list)
On Wed, 2006-04-05 at 17:15 -0700, Christopher Burnley wrote:
> In my code I had previously stored things in the session by typing:
> session[:xyz]= "blah"
> and everything worked, then I upgraded to 1.1 and started getting the
> errors. I went in and refactored all the session[:xyz] references to
> @session[:xyz]= "blah"
> bounced the server and everything worked like a charm. The strange
> thing was that this only affected production. I could load the
> console or webrick and everything behaved as expected which is why I
> am not certain if the problem somehow magically got fixed between
> server bounces but it is worth trying if you are having the same
> problem.
----
FWIW, I use session[:key] = "value" (probably too frequently) and the
migration to rails 1.1 had no impact on me and I have refactored
nothing.
CentOS 4
httpd-2.0.52-22 (apache)
mod_fastcgi 2.4.2

Caig
Adam D. (Guest)
on 2006-04-08 18:15
(Received via mailing list)
this is starting to feel very buggy.  This time all I did was change one
line of an rhtml file, reload the browser and I got the error.

Maybe because I load my model into the session like

@entry = User.find(3)
@session[:user] = @entry

when a user first logs in Its causing some funky behavior in rails ?  I
dont
think adding a few lines of html to an rhtml file would make this popup
b/c
thats what happened this time.

adam
Bill W. (Guest)
on 2006-04-08 18:33
(Received via mailing list)
Hi Adam,

I think that perhaps what Craig was suggesting was that you replace
@session[] with session[].  As I understand it, use of the @ is being
deprecated to make local vs. instance vs. (what the heck is the right
word to use for the type for session and params?).  I was told this WRT
@params, and I'd bet it's true for @session too.

hth,
Bill
  ----- Original Message -----
  From: Adam D.
  To: removed_email_address@domain.invalid
  Sent: 2006-04-08 9:13 AM
  Subject: Re: [Rails] Re: session error in rails 1.1


  this is starting to feel very buggy.  This time all I did was change
one line of an rhtml file, reload the browser and I got the error.

  Maybe because I load my model into the session like

  @entry = User.find(3)
  @session[:user] = @entry

  when a user first logs in Its causing some funky behavior in rails ?
I dont think adding a few lines of html to an rhtml file would make this
popup b/c thats what happened this time.

  adam


  On 4/5/06, Craig W. <removed_email_address@domain.invalid> wrote:
    On Wed, 2006-04-05 at 17:15 -0700, Christopher Burnley wrote:
    > I'm not sure if this is correct or will help, but I ran into a
    > problem after the 1.1 on my production server (FreeBSD 6.0,
Apache2,
    > fast_cgi) where I would get an "application error". It took me a
    > while to figure out that the objects I was storing in the session
    > objects were coming back nil when accessed within a view. I did
the
    > usual job of deleting the RUBY.Session objects in the temp
directory,
    > bounced the web server and the problem was still there. I started
to
    > think maybe there was an issue of scope with respect to the
session
    > objects.
    >
    > In my code I had previously stored things in the session by
typing:
    > session[:xyz]= "blah"
    > and everything worked, then I upgraded to 1.1 and started getting
the
    > errors. I went in and refactored all the session[:xyz] references
to
    > @session[:xyz]= "blah"
    > bounced the server and everything worked like a charm. The strange
    > thing was that this only affected production. I could load the
    > console or webrick and everything behaved as expected which is why
I
    > am not certain if the problem somehow magically got fixed between
    > server bounces but it is worth trying if you are having the same
    > problem.
    ----
    FWIW, I use session[:key] = "value" (probably too frequently) and
the
    migration to rails 1.1 had no impact on me and I have refactored
    nothing.
    CentOS 4
    httpd-2.0.52-22 (apache)
    mod_fastcgi 2.4.2

    Caig

    _______________________________________________
    Rails mailing list
    removed_email_address@domain.invalid
    http://lists.rubyonrails.org/mailman/listinfo/rails





------------------------------------------------------------------------------


  _______________________________________________
  Rails mailing list
  removed_email_address@domain.invalid
  http://lists.rubyonrails.org/mailman/listinfo/rails
Adam D. (Guest)
on 2006-04-08 19:06
(Received via mailing list)
Thanks Bill I will give that a shot.

I assume this means in the views too right ?

adam
Craig W. (Guest)
on 2006-04-08 20:39
(Received via mailing list)
indeed, that is what I meant...

see this link from wiki.rubyonrails.org

http://wiki.rubyonrails.org/rails/pages/HowtoWorkW...

Craig
This topic is locked and can not be replied to.