Hi, Does anyone know is it possible to have more than one sessions in a web application? If it is possible, can someone please tell me how can I acheive this? Thanks fries 88 -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Why would you want to do this? On Jan 14, 2008 1:03 PM, fries 88 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > Does anyone know is it possible to have more than one sessions in a web > application? If it is possible, can someone please tell me how can I > acheive this? > > Thanks > fries 88 > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Why would you want to do this? > > On Jan 14, 2008 1:03 PM, fries 88 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.I kept counters in the session. Then I assigned counters to my page so that when I first enter the page, I will be able to save and the subsequent time I enter the same page I will be able to edit the data I saved previously. I have to do this for many other pages too. So I was thinking of having one session for a page. But I am not sure if it is right or possible. controller: def find_count session[:count] ||= 0 session[:count] += 1 if session[:count] == 1 redirect_to :action => ''prod_desc'' else redirect_to :action => ''update_prod_desc'' end end -- 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-/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 -~----------~----~----~----~------~----~------~--~---
I''m not sure what you''re trying to do but can''t you do: session[:count] and then session[:othercount] On Jan 13, 9:18 pm, fries 88 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ryan Bigg wrote: > > Why would you want to do this? > > > On Jan 14, 2008 1:03 PM, fries 88 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > >> Posted viahttp://www.ruby-forum.com/. > > > -- > > Ryan Bigg > >http://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email. > > I kept counters in the session. Then I assigned counters to my page so > that when I first enter the page, I will be able to save and the > subsequent time I enter the same page I will be able to edit the data I > saved previously. I have to do this for many other pages too. So I was > thinking of having one session for a page. But I am not sure if it is > right or possible. > > controller: > > def find_count > session[:count] ||= 0 > session[:count] += 1 > > if session[:count] == 1 > redirect_to :action => ''prod_desc'' > else > redirect_to :action => ''update_prod_desc'' > > end > end > -- > Posted viahttp://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-/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 -~----------~----~----~----~------~----~------~--~---
I dont think this is the right way to go about it. You should have a link to create the data, and then another link to edit. You can decide which one shows by checking to see if the data exists before doing it. It sounds like you''re over-complicating something. -- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jan 13, 2008, at 9:18 PM, fries 88 wrote:> I kept counters in the session. Then I assigned counters to my page so > that when I first enter the page, I will be able to save and the > subsequent time I enter the same page I will be able to edit the > data I > saved previously. I have to do this for many other pages too. So I was > thinking of having one session for a page. But I am not sure if it is > right or possible. > > > controller: > > def find_count > session[:count] ||= 0 > session[:count] += 1 > > if session[:count] == 1 > redirect_to :action => ''prod_desc'' > else > redirect_to :action => ''update_prod_desc'' > > end > end > -- >One thing you can do is reference each page in the session. Something like session[:page_name][:counter] If you want to automate it completely, you can even do session[controller_name][action_name][:counter] though I would probably convert controller_name and action_name to symbols with session[controller_name.to_sym][action_name.to_sym][:counter] On the other hand, if you only want to do manually, you can use a before filter to set a variable that you then use as the key into the session hash. Having said that, Ryan might be onto something. You might want to step back and re-evaluate your requirements to see if you are overcomplicating some process. Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---