hnchuong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Dec-25 09:06 UTC
Question about instant variable in views and request parameters
Hi all, I have a difficulty which I would like to ask for help. I passed parameters to a view in the form of URL parameters (...?param1=xxx¶m2=yyy), and use these parameters to initialize an instant variable (say @var1) in an action method of my controller. In that view there''re some AJAX stuffs. Following are my difficulty: 1. In subsequent action methods called by AJAX, I need to access the @var1 (already initialized before), but @var1 return nil. How could i keep the value of @var1 across action methods? I guess the controller is singleton, so @var1 will be like a global variable and its value will be kept available across requests - but clearly it''s not the case. Could anyone explain how I''m wrong? 2. I would like to re-initialize @var1 using request parameters (param1, param2...). However in subsequent action methods called by AJAX stuffs, how can I access these parameters, as they''re not in params any more (they''re still there on URL). Sorry for these newbie questions. Thank a lot for help. - Chuong --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---