Hello! 1. I have 2 domains site1.com and site2.com. The same application is installed on both, but I need it to use different database: db1 for site1.com and db2 for site2.com How can I do this? 2. And another question about subdomains. Usually I use something like that: link_to ''Link title'', :sort => ''soft_field'' - and this produces a link to the current url with additonal ?sort=sort_field parameter: http://site1.com/controller/?sort=-sort_field But this doesn''t work on subdomains when I use subdomain fu, I get something like that: http:///controller/?sort=-sort_field What is wrong here and how can I corrent this? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> 2. > And another question about subdomains. > Usually I use something like that: > link_to ''Link title'', :sort => ''soft_field'' - and this produces a link > to the current url with additonal ?sort=sort_field parameter:http://site1.com/controller/?sort=-sort_field > But this doesn''t work on subdomains when I use subdomain fu, I get > something like that: > http:///controller/?sort=-sort_field > What is wrong here and how can I corrent this?This problem was resolved by hacking subdomain_fu as it''s described in this post: http://www.portallabs.com/blog/2008/10/22/fixing-subdomain_fu-with-named-routes/ But I still don''t know how to use different databases for different domains. Any help is highly appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 first question remains, please, give me a key to resolve the issue. Currently I see only one way: symlink all files from one domain to another except /config folder, and put custom /config to every domain. But there should be more elegant solution! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Haven''t done it myself, but have you looked at ActiveRecord::Base.establish_connection? If you can establish model-specific connections, you should be able to establish a specific connection for a specific subdomain. -- 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 9 мар, 16:33, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Haven''t done it myself, but have you looked at > ActiveRecord::Base.establish_connection? > > If you can establish model-specific connections, you should be able to > establish a specific connection for a specific subdomain.Okay, thanks! The main problem is that I don''t know where to put a code for re- defining database connection. Should it be somewhere in initializers? Will I have an access to host name there? Also, I have some parameters in config/enviroments/production.rb and they should be changed for another domain too --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---