I have two applications, appA and appB. I want to use single sign on for both the apps. Meaning, if a user logs in to appA, he dont have to login to appB and conversely, if a user logged out of appA, it logs him out of appB too. Just like in google''s various products. I created the sessions table in appA. How do i access the sessions table in appB. I tried to put ActiveRecord::Base.establish_connection :appA in the config\initializers\session_store.rb of appB, but that connects the whole appB application to appA database. I only want to access the sessions table. How do i do it? database.yml of appB has: appA: adapter: mysql database: appa_dev pool: 5 username: app_user password: app_pwd host: localhost Thanks, Pratik -- 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 Mar 6, 5:55 pm, tispratik <tispra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have two applications, appA and appB. I want to use single sign on > for both the apps. > Meaning, if a user logs in to appA, he dont have to login to appB and > conversely, if a user logged out of appA, it logs him out of appB too. > Just like in google''s various products. > > I created the sessions table in appA. How do i access the sessions > table in appB. > I tried to put ActiveRecord::Base.establish_connection :appA in the > config\initializers\session_store.rb of appB, > but that connects the whole appB application to appA database. I only > want to access the sessions table. > > How do i do it?... I do not have an answer to your specific question, but I have 2 Rails apps that share the session and thus feature a single sign-on. But I use session in cookies, not session in a db table. -- 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.
On Sat, Mar 6, 2010 at 5:55 PM, tispratik <tispratik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have two applications, appA and appB. I want to use single sign on > for both the apps. > Meaning, if a user logs in to appA, he dont have to login to appB and > conversely, if a user logged out of appA, it logs him out of appB too. > Just like in google''s various products. > > I created the sessions table in appA. How do i access the sessions > table in appB. > I tried to put ActiveRecord::Base.establish_connection :appA in the > config\initializers\session_store.rb of appB, > but that connects the whole appB application to appA database. I only > want to access the sessions table. > > How do i do it? > > database.yml of appB has: > appA: > adapter: mysql > database: appa_dev > pool: 5 > username: app_user > password: app_pwd > host: localhost > Thanks, > Pratik > >Pratik, have you considered OpenID or CAS? If not, I would like into those as possible solutions as well. Good luck, -Conrad> -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Hassan Schroeder
2010-Mar-08 18:34 UTC
Re: Connecting to sessions table in another database
On Sat, Mar 6, 2010 at 5:55 PM, tispratik <tispratik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I created the sessions table in appA. How do i access the sessions > table in appB. > I tried to put ActiveRecord::Base.establish_connection :appA in the > config\initializers\session_store.rb of appB, > but that connects the whole appB application to appA database. I only > want to access the sessions table.Then you need to use establish_connection *only* in the model that''s accessing that table. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.