I''m looking for a way to share one ActiveRecordStore session between multiple apps. I''m sure its possible, but not sure how. Ideas? --~--~---------~--~----~------------~-------~--~----~ 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 guess this would hinge on setting a domain level cookie, as its the cookie which hooks in the session id. You could then connect to a shared database for your session store in databases.yml you''d have to define sessions_development: host: blah name: blah sessions_test: blah .. class ActiveRecordStore::Session establish_connection("sessions#{RAILS_ENV}".intern) end and probably class ActiveRecordStore::SqlBypass.connection = ActiveRecordStore::Session.connection haven''t tried it, but it makes sense, I think. Jarod Reid wrote:> I''m looking for a way to share one ActiveRecordStore session between > multiple apps. I''m sure its possible, but not sure how. Ideas?-- 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 -~----------~----~----~----~------~----~------~--~---
and of course, you get into a whole annoying world if your running your tests off multiple dbs. (you may just want to keep the same database for dev and test) -- 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 -~----------~----~----~----~------~----~------~--~---
On Jul 18, 2007, at 08:45 , Jarod Reid wrote:> > I''m looking for a way to share one ActiveRecordStore session between > multiple apps. I''m sure its possible, but not sure how. Ideas?Memcache. :-) If you use Memcache to store your sessions, then you can easily access data across your applications. You just need to make sure you don''t have namespace collisions or your data will get mixed up between the sites. I know, not a very traditional solution to this problem, but for sites running on more than one server Memcache should be used anyway IMHO so you get the added benefit for free. -- Mitch --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mitch Pirtle wrote:> On Jul 18, 2007, at 08:45 , Jarod Reid wrote: > > >> I''m looking for a way to share one ActiveRecordStore session between >> multiple apps. I''m sure its possible, but not sure how. Ideas? >> > > Memcache. :-) > > If you use Memcache to store your sessions, then you can easily > access data across your applications. You just need to make sure you > don''t have namespace collisions or your data will get mixed up > between the sites. > > I know, not a very traditional solution to this problem, but for > sites running on more than one server Memcache should be used anyway > IMHO so you get the added benefit for free. > > -- Mitch > > > > >Thanks Mitch. Memcache would probably work however at the moment it isn''t in the cards. The apps use the same database to store sessions. The question is how to make the session persist across apps. --~--~---------~--~----~------------~-------~--~----~ 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 Jul 18, 2007, at 6:46 AM, Jarod Reid wrote:> > Thanks Mitch. Memcache would probably work however at the moment it > isn''t in the cards. The apps use the same database to store sessions. > The question is how to make the session persist across apps.Short answer, you can''t :/ Longer answer: It''s easy enough to share the database sessions table but the cookies that store the session_id are tied to the domain they we''re served from. So the only way to share the sessons out of the box is to use subdomains and set the session cookie correctly. set the sessions cookie domain to .example.com the . is important Then you can use the same sessions cookies across subdomains like foo.example.com bar.example.com Cheers- -- Ezra Zygmuntowicz -- Founder & Ruby Hacker -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ezra Zygmuntowicz wrote:> On Jul 18, 2007, at 6:46 AM, Jarod Reid wrote: > > >> Thanks Mitch. Memcache would probably work however at the moment it >> isn''t in the cards. The apps use the same database to store sessions. >> The question is how to make the session persist across apps. >> > > > Short answer, you can''t :/ Longer answer: It''s easy enough to share > the database sessions table but the cookies that store the session_id > are tied to the domain they we''re served from. So the only way to > share the sessons out of the box is to use subdomains and set the > session cookie correctly. > > set the sessions cookie domain to .example.com the . is important > > Then you can use the same sessions cookies across subdomains like > foo.example.com bar.example.com > > > Cheers- > > -- Ezra Zygmuntowicz > -- Founder & Ruby Hacker > -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org > -- Engine Yard, Serious Rails Hosting > -- (866) 518-YARD (9273) > > > > > > >Ezra, thats more along the lines of what I thought it would be. And it works well enough for my needs. Out of curiosity, though, could one persist the actual object using DRB? -- Jarod --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The real answer to your question depends on what exactly you are trying to accomplish. Sharing sessions might be the best, or even a good solution. For example if your apps all require a login, just create a separate table to hold the information you want to share and key it off the username. Memcache would be perfect for this, not sure why you are ruling it out. If your apps all require a login, and the shared data absolutely has to be saved on every request, then you can share sessions by creating a username column in the sessions table, and modify activerecord so when someone logs in it checks to see if a session exists for the user, and if so resets the cookie session id to that user. That way lies madness, but it can work in the right circumstances. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---