I have a couple of session parameters set in a Controller which I want to use in a different Controller. Which is the cleanest way to do this? I did quite a bit of Googling but could not come up with anything substancial. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/E5-CFAhjTXQJ. 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.
Session variables should be shared, unless I''m not understanding the question. You can set a session variable in one controller like so: session[:my_key] = ''my value'' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/p226gFvWNjwJ. 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.
In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote:> > Session variables should be shared, unless I''m not understanding the > question. > > You can set a session variable in one controller like so: > > session[:my_key] = ''my value'' > > Then access it in another controller by simply calling session[:my_key] >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. 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 8 March 2012 15:06, Myth17 <nitishupreti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In my application once I call an action on a different controller all my > session variables seem to disappear also the login session seems to expire. > Even if I start a new request from browser I need to authenticate again.Something is clearing the session then. Do a global search in the code for session and see if you clear it anywhere. If you find it cleared anywhere, even if you think that code should not be called, then put some debug in to check (or just comment out the clear for temporarily). Colin> > > On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: >> >> Session variables should be shared, unless I''m not understanding the >> question. >> >> You can set a session variable in one controller like so: >> >> session[:my_key] = ''my value'' >> >> Then access it in another controller by simply calling session[:my_key] > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. > > 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.-- gplus.to/clanlaw -- 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.
Its actually weird then, I did a search to double check but I am not clearing the session anywhere. :| On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote:> > On 8 March 2012 15:06, Myth17 <nitishupreti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > In my application once I call an action on a different controller all my > > session variables seem to disappear also the login session seems to > expire. > > Even if I start a new request from browser I need to authenticate > again. > > Something is clearing the session then. Do a global search in the > code for session and see if you clear it anywhere. If you find it > cleared anywhere, even if you think that code should not be called, > then put some debug in to check (or just comment out the clear for > temporarily). > > Colin > > > > > > > On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: > >> > >> Session variables should be shared, unless I''m not understanding the > >> question. > >> > >> You can set a session variable in one controller like so: > >> > >> session[:my_key] = ''my value'' > >> > >> Then access it in another controller by simply calling session[:my_key] > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. > > > > 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. > > -- > gplus.to/clanlaw > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8NOJZMxFjXAJ. 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.
I can see message "WARNING: Can''t verify CSRF token authenticity" on the rails console. Could this be the reason? On Thursday, March 8, 2012 9:17:08 PM UTC+5:30, Myth17 wrote:> > Its actually weird then, I did a search to double check but I am not > clearing the session anywhere. :| > > On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote: >> >> On 8 March 2012 15:06, Myth17 <nitishupreti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > In my application once I call an action on a different controller all my >> > session variables seem to disappear also the login session seems to >> expire. >> > Even if I start a new request from browser I need to authenticate >> again. >> >> Something is clearing the session then. Do a global search in the >> code for session and see if you clear it anywhere. If you find it >> cleared anywhere, even if you think that code should not be called, >> then put some debug in to check (or just comment out the clear for >> temporarily). >> >> Colin >> >> > >> > >> > On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: >> >> >> >> Session variables should be shared, unless I''m not understanding the >> >> question. >> >> >> >> You can set a session variable in one controller like so: >> >> >> >> session[:my_key] = ''my value'' >> >> >> >> Then access it in another controller by simply calling session[:my_key] >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Ruby on Rails: Talk" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. >> > >> > 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. >> >> -- >> gplus.to/clanlaw >> >>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/c9d1Cdc7BgYJ. 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 8 March 2012 15:53, Myth17 <nitishupreti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I can see message "WARNING: Can''t verify CSRF token authenticity" on the > rails console. Could this be the reason?Yes, probably. Rails is clearing the session because it detects the problem. Google for the message and you will find lots of hits. Colin> > > On Thursday, March 8, 2012 9:17:08 PM UTC+5:30, Myth17 wrote: >> >> Its actually weird then, I did a search to double check but I am not >> clearing the session anywhere. :| >> >> On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote: >>> >>> On 8 March 2012 15:06, Myth17 <nitishupreti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> > In my application once I call an action on a different controller all >>> > my >>> > session variables seem to disappear also the login session seems to >>> > expire. >>> > Even if I start a new request from browser I need to authenticate >>> > again. >>> >>> Something is clearing the session then. Do a global search in the >>> code for session and see if you clear it anywhere. If you find it >>> cleared anywhere, even if you think that code should not be called, >>> then put some debug in to check (or just comment out the clear for >>> temporarily). >>> >>> Colin >>> >>> > >>> > >>> > On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: >>> >> >>> >> Session variables should be shared, unless I''m not understanding the >>> >> question. >>> >> >>> >> You can set a session variable in one controller like so: >>> >> >>> >> session[:my_key] = ''my value'' >>> >> >>> >> Then access it in another controller by simply calling >>> >> session[:my_key] >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> > Groups >>> > "Ruby on Rails: Talk" group. >>> > To view this discussion on the web visit >>> > https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. >>> > >>> > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. >>> > 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. >>> >>> -- >>> gplus.to/clanlaw > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/c9d1Cdc7BgYJ. > > 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.-- gplus.to/clanlaw -- 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.