Is it possible to have a RoR application serving two different websites/domain names? I''m creating a simple discussion group application... but I''d like my RoR instance to be shared between these domains. So, in my routes... can i pass down to my application what the domain name is? Entries in my database can then have a domain field! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
In one of my ror apps, it handles multiple domains -- I just check request.env[''SERVER_NAME'']. Joe -- 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 -~----------~----~----~----~------~----~------~--~---
Ah, thanks for the info Joe I''ve been playing around with the new ActiveResource. Initially thought I would determine the current domain in the routes.rb, but looks like it''s best done in the controllers. Will have to do a bit more thinking. Still a newbie to rails, so hopefully I haven''t bitten off more than I can chew :) On 27/09/2006, at 7:52 PM, Joe Ruby MUDCRAP-CE wrote:> request.env[''SERVER_NAME'']--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
We did it using a before_filter in the ApplicationController and added a table of domains to our database. That way, we can store basic info about the site in the database. Something like this: before_filter :site def site #### get the site from the session, or from the domain if it hasn''t been loaded yet. logger.warn("The Domain is #{request.domain}") session[:site] = Site.find_by_domain(request.domain) unless (session[:site] && session[:site].domain == request.domain) @site = session[:site] end -ron On 9/27/06, Jason B <jasjbow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Ah, thanks for the info Joe > > I''ve been playing around with the new ActiveResource. Initially thought I > would determine the current domain in the routes.rb, but looks like it''s > best done in the controllers. > > Will have to do a bit more thinking. Still a newbie to rails, so > hopefully I haven''t bitten off more than I can chew :) > > > > > On 27/09/2006, at 7:52 PM, Joe Ruby MUDCRAP-CE wrote: > > request.env[''SERVER_NAME''] > > > > > >-- Ron Miles ronald.miles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 413.329.4277 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, At the moment i have a controller called main_controller and in the views folder a folder called main with all the view files. I have put in the routes.rb file the following code map.connect '':action/:id'', :controller => ''main'', :action => ''home'' The above works fine so for when i enter http://localhost:3006/news i get the news page and so on. Inside the main folder in views i have created another folder called reviews(views/main/reviews/) and placed some view file associated with reviews. I have also created a new controller called reviews and placed it in controllers/main/ so now if i click the follwoing link below i get a routing error No action responed to Main <%= link_to ''Reviews'', :action => ''index'', :controller => ''main/tech_reviews'' %> I can get this to work if i take out the reviews folder from views/main/reviews and place it just in the views folder but it really belongs in the main folder as it is part of the main functionality of the site. Can someone plase help me organise my routes file to dela with this as ive tried numerous routes but if i can get the reviews working then the main doesnt and vice versa. Stuuf ive tried is: map.connect '':action/:id'', :controller => ''main/reviews'', :action => ''index'' map.connect '':action/:id'', :controller => ''main'', :action => ''home'' -- 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 -~----------~----~----~----~------~----~------~--~---
John Butler wrote:> <%= link_to ''Reviews'', :action => ''index'', :controller => > ''main/tech_reviews'' %>Sorry the line above should read <%= link_to ''Reviews'', :action => ''index'', :controller => ''main/reviews'' %> Any help appreciated. -- 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 -~----------~----~----~----~------~----~------~--~---
John Butler wrote:> John Butler wrote: > >> <%= link_to ''Reviews'', :action => ''index'', :controller => >> ''main/tech_reviews'' %> > > Sorry the line above should read > > <%= link_to ''Reviews'', :action => ''index'', :controller => > ''main/reviews'' %> > > Any help appreciated.Manged to solve it: Routes.rb map.connect ''reviews/:action/:id'', :controller => ''main/reviews'', :action => ''index'' map.connect '':action/:id'', :controller => ''main'', :action => ''home'' and for the links within my site <%= link_to ''Home'', :action => ''home'', :controller => ''/main''%> <%= link_to ''Reviews'', :action => ''index'', :controller => ''/main/reviews'' %> -- 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 -~----------~----~----~----~------~----~------~--~---