plz help me anyone we are writing some value to global varible in application_helper file and accessing the same in views and layouts the value of global varible changes dynamically whenever user logs in (Example if user1 and user2 logs in at same time sometimes user2 is veiwing user1 deatils in that global varible we are running the application in production mode with apache 2.x version and passeneger 2.x version ) .plz suggest us how to use global varible in this scenario -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2009/12/21 Nandan Kumar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> plz help me anyone we are writing some value to global varible in > application_helper file and accessing the same in views and layouts the > value of global varible changes dynamically whenever user logs in > (Example if user1 and user2 logs in at same time sometimes user2 is > veiwing user1 deatils in that global varible we are running the > application in production mode with apache 2.x version and passeneger > 2.x version ) .plz suggest us how to use global varible in this scenarioThe solution is to not use global variables. It may be that session variables are appropriate for your requirement if you wish data for a user to persist across server requests. If you do not require persistence then just use instance variables. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 21, 6:12 am, Nandan Kumar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> plz help me anyone we are writing some value to global varible in > application_helper file and accessing the same in views and layouts the > value of global varible changes dynamically whenever user logs in > (Example if user1 and user2 logs in at same time sometimes user2 is > veiwing user1 deatils in that global varible we are running the > application in production mode with apache 2.x version and passeneger > 2.x version ) .plz suggest us how to use global varible in this scenario.I would say "GB2PHP" based on this, but it wouldn''t work there either... :) Seriously - 99% of the time, if you''re using a global variable, you''re doing it wrong. Take a look at session variables in the ActionController::Base docs: http://api.rubyonrails.org/classes/ActionController/Base.html I''d also *strongly* recommend that you get a good (recent) Rails reference like Agile Web Development with Rails (3rd ed). --Matt Jones -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.