Weird "session-bug" when using multiple calls

cubiqsys-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Tue, 26 Feb 2008 16:50:33 -0000

Hi!

Can someone understand why this happens?

http://pastebin.com/mde5f1b7

-------

#controller
class StartController < ApplicationController
        append_before_filter :get_page_settings
        def get_page_settings()
                session[:testlist] ||= Hash.new
        end

        def fillsession
                render :update do |page|
                        page.alert(session[:testlist].inspect)
                        session[:testlist]["ken"] = "man"
                        session[:testlist]["barbie"] =
"woman"
                        page.alert(session[:testlist].inspect)
                end
        end

        def printstart
                render :partial => "startnav"
        end
end

#index.rhtml


        new
Ajax.Updater(''startnav'',''/start/printstart'');



<%=link_to_remote("Fill session", :url => { :action =>
"fillsession" })
%>

#_startnav.rhtml
<% sleep(5); %>
Hello World!

#1. I go to start/index
#2. The printstart trigger but starts to sleep
#3. Meanwhile I push the "Fill session"-link, which first alerts an
empty Hash, then {"barbie"=>"woman",
"ken"=>"man"}
#4. The sleep is over and Hello World! displays
#5. I push the "Fill session"-link again. It should now alert
{"barbie"=>"woman", "ken"=>"man"}
two times, but instead the session
is empty and alerts an empty hash the first time :( Why?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org