Put many resources and paths under subdomain (Rails Routes) -


i'd forward bunch of stuff subdomain in rails applications (including nested resources), without going through views update link_to _path links. possible?

edit

so far have following. problem is, can access either or without subdomain, without being redirect once enter or leave resource should on subdomain. e.g. example.com/apps same connect.example.com/apps, , site root can either example.com or connect.example.com

scope '/'  with_options :conditions => {:subdomain => 'connect'} |site|    site.resources :contracts   site.resources :bills   site.resources :feedbacks   site.resources :newsletters   site.resources :contacts   site.resources :apps     site.resources :elements, controller: 'apps/elements'       site.resources :features, except: [:index], controller: 'apps/elements/features'         member           site.post 'complete'         end       end     end     site.resources :comments, controller: 'comments'     site.resources :bills, controller: 'bills'     site.resources :contracts, controller: 'contracts'      end   end end 

edit 2

config.middleware.insert_before(rack::lock, rack::rewrite)      r307 %r{/apps/(.*)}, 'http://connect.localhost:3000/apps/$1' end 

https://github.com/jtrupiano/rack-rewrite let this. it's web server agnostic won't matter you're on heroku.

eg.

config.middleware.insert_before(rack::runtime, rack::rewrite)   r307 %r{/apps/(.*)}, 'http://connect.example.com/apps/$1' end 

will issue redirect requests /apps/ go connect.example.com/apps/


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -