Here is the situation: We have one rails app that is built around our fairly large DB. Since we have many models and logic inside those models, it makes sense for us to build only one rails app and share it among several different sites (Public web site, internal data backend, etc). The thing I can''t quite get my head around is how to forward requests (using lighty) from different domains to top level controllers within the rails app: Example: mysite.com -> site controller data.mysite.com -> data controller etc.. The productize plugin seems to be overkill, as we aren''t extending the app or using different DBs for the different domains. Any thoughts? -- Posted via http://www.ruby-forum.com/.
Brad Daily wrote:> Here is the situation: We have one rails app that is built around our > fairly large DB. Since we have many models and logic inside those > models, it makes sense for us to build only one rails app and share it > among several different sites (Public web site, internal data backend, > etc). > > The thing I can''t quite get my head around is how to forward requests > (using lighty) from different domains to top level controllers within > the rails app: > > Example: > > mysite.com -> site controller > data.mysite.com -> data controller > > etc.. The productize plugin seems to be overkill, as we aren''t extending > the app or using different DBs for the different domains. Any thoughts?You could do something like: before_filter { |c| redirect_to :controller=> c.request.subdomains.first, :action => ''index'' } This is untested by they way,but it should work. -- Posted via http://www.ruby-forum.com/.
Found a good solution (I think) :) Instead of trying to consolidate into one app, I have kept the three separate rails apps that we have so far. However, with the two apps that build off of the main app''s model structure, I have emptied their models folder. Then, in their environments.rb file, I have added the following... config.load_paths += %W( /home/www/data/app/models ) This way, these apps can directly load the models from the main app, but still retain their individuality. Working great so far, just have to figure out a way to work with it locally.... -- Posted via http://www.ruby-forum.com/.
Hi Brad, did you ever figure out a way to make this work locally? Brad Daily wrote:> Found a good solution (I think) :) > > Instead of trying to consolidate into one app, I have kept the three > separate rails apps that we have so far. However, with the two apps that > build off of the main app''s model structure, I have emptied their models > folder. Then, in their environments.rb file, I have added the > following... > > config.load_paths += %W( /home/www/data/app/models ) > > This way, these apps can directly load the models from the main app, but > still retain their individuality. Working great so far, just have to > figure out a way to work with it locally....-- 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 -~----------~----~----~----~------~----~------~--~---
There is a routing request plugin that should work here. Make sure to check it''s read me file. Bill -- 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 -~----------~----~----~----~------~----~------~--~---