Hi, I have 4 apps using similar User tables(3 open source projects and one in-house app). I''m trying to merge into one shared database User table (external to all 4 apps). ------------------------------------------------------------------------------------------ I''m using the following code in the User model to switch to the shared database: class User < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. User.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "ua_production" ) ------------------------------------------------------------------------------------------ Then, I have to switch the other models back: class Attachment < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. Attachment.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "redmine" ) ------------------------------------------------------------------------------------------ I added the above to all the other models in my Redmine app. So, now the views that are trying to do a SQL JOIN are bombing. Is there an easier way? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, I have 4 apps using similar User tables(3 open source projects and one in-house app). I''m trying to merge into one shared database User table (external to all 4 apps). ------------------------------------------------------------------------------------------ I''m using the following code in the User model to switch to the shared database: class User < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. User.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "ua_production" ) ------------------------------------------------------------------------------------------ Then, I have to switch the other models back: class Attachment < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. Attachment.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "redmine" ) ------------------------------------------------------------------------------------------ I added the above to all the other models in my Redmine app. So, now the views that are trying to do a SQL JOIN are bombing. Is there an easier way? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, I have 4 apps using similar User tables(3 open source projects and one in-house app). I''m trying to merge into one shared database User table (external to all 4 apps). ------------------------------------------------------------------------------------------ I''m using the following code in the User model to switch to the shared database: class User < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. User.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "ua_production" ) ------------------------------------------------------------------------------------------ Then, I have to switch the other models back: class Attachment < ActiveRecord::Base # GSL, 03/18/09 - Add reference to external ua database. Attachment.establish_connection ( :adapter => "mysql", :host => "example.corp.example.com", :username => "root", :password => "?", :database => "redmine" ) ------------------------------------------------------------------------------------------ I added the above to all the other models in my Redmine app. So, now the views that are trying to do a SQL JOIN are bombing. Is there an easier way? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Donald
2009-Mar-24 17:51 UTC
Re: 4 Rails apps using the same table. How to streamline?
On Tue, Mar 24, 2009 at 11:50 AM, LaughingNinja <glackerman-ITnRlqvgIl2aMJb+Lgu22Q@public.gmane.org> wrote:> So, now the views that are trying to do a SQL JOIN are bombing. > > Is there an easier way?Are you sure something''s not correct with your model relationships? What do they look like exactly? What do the errors from the bombing look like? -- Greg Donald http://destiney.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
James Byrne
2009-Mar-24 18:06 UTC
Re: 4 Rails apps using the same table. How to streamline?
LaughingNinja wrote: ---------------------------> I added the above to all the other models in my Redmine app. > > So, now the views that are trying to do a SQL JOIN are bombing. >Are you trying to join tables from different connections/database instances? -- 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 -~----------~----~----~----~------~----~------~--~---