Hi, I am developing a sort of CMS application that will be used by multiple domains on my host. Each domain requires its own set of users, news, etc., but I would like to keep my application only installed one place on my host and sym-link to it. Is it possible to modify all queries to also include a ''domain'' in the where clause or something like that? i.e. if i do a Table.find(:all) in one of my controllers, and that controller is being accessed by domain1, can I limit the query''s results by some sort of where clause? I dabbled with the idea of using table prefix''s, but later ditched the idea. It seems like the appropriate solution is to add another column to my tables that includes which domain the data is specific to and somehow limit that in the application... any ideas? Thanks, jay --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dustin Anderson
2007-Aug-10 15:29 UTC
Re: One Application, Multiple Domains.. separate data?
Can''t you make multiple accounts like: http://myapp/user/1 is linked from http://www.johndoe.com and http://myapp/user/2 is linked from http://www.billybob.com (and only have table lookups for user/1 be for that user, etc.?) like: Table.find(:all, :conditions => ["user = ?", params[:id]]) I''m no expert, but I have an application working that does the same thing - and I can''t remember if it''s simlinked or we did some other domain forwarding or what on the host to handle the multiple domain names... -- 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 guess this is possible, but I will have to look more into linking/ forwarding. For instance, domain1.com/news/show/1 would need to tell the application to find the news with :id of 1, but ALSO where domain=1. Can I link so that all urls also pass along an extra set of parameters? -Jay On Aug 10, 10:29 am, Dustin Anderson <rails-mailing-l...@andreas- s.net> wrote:> Can''t you make multiple accounts like: > > http://myapp/user/1 > is linked fromhttp://www.johndoe.com > > andhttp://myapp/user/2 > is linked fromhttp://www.billybob.com > > (and only have table lookups for user/1 be for that user, etc.?) > > like: > > Table.find(:all, :conditions => ["user = ?", params[:id]]) > > I''m no expert, but I have an application working that does the same > thing - and I can''t remember if it''s simlinked or we did some other > domain forwarding or what on the host to handle the multiple domain > names... > -- > 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 -~----------~----~----~----~------~----~------~--~---
It might be useful to consider creating a different database instance for each client/domain and simply customizing the database entries in config/database.yml to suit. As I recall it is possible to place ruby code in there so you may even be able to automate the the custom configuration based on the incoming domain. This also allows for clean separation of user data for backups, restores and service termination. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Jay, I''ve faced the same problem twice and once was for a project similar to yours. There are essentially to ways: 1)a unique base code and a unique db with a field identifying the customer in the tables; 2)a unique base code and multiple databases (one per customer). For the CMS project I followed the second way and the main problem is when you need to change the DB structure but I think rake could help you a lot. Having faced these problems and being working with PHP I then tried the first way but I''ve to tell you that the development is much slower since almost each query require to take in consideration the customer_id. Furthermore as the db grows some queries get very slow so you have to tune them carefully. Should you use a single DB you may consider partitioning the DB which is available as of MySQL 5.1, that could help you make the queries faster. This is in summary my experience. After finishing the second project I finally found a document with a in depth discussion of these alternatives and ... it''s published by M$, here''s the link: http://msdn2.microsoft.com/en-us/library/Aa479086.aspx Nik -- 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 -~----------~----~----~----~------~----~------~--~---
Roderick van Domburg
2007-Aug-10 17:50 UTC
Re: One Application, Multiple Domains.. separate data?
unreal wrote:> It seems like the appropriate solution is to add another column to my > tables that includes which domain the data is specific to and somehow > limit that in the application... any ideas?Have you looked into a combination of account_location and scope_out plugins? -- Roderick van Domburg http://www.nedforce.nl -- 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 -~----------~----~----~----~------~----~------~--~---