show one application on 2 site with different front ends but same back end, in ROR hosted on heroku

天大地大妈咪最大 提交于 2019-12-25 02:57:56

问题


I have an application in rails and hosted on Heroku. Now , what I want is that the application can be accessed from 2 different domains, when the application is accessed from suppose a.com it should have a specific frontend, and when accessed from b.com it should display some other frontend. The backend should be same for both. To achieve this I suppose there is only one way I guess, which is to have two different application with same backed code, and same database(I am using PostgreSQL). I need some help on how Do I achieve this, if not, then some other alternative.


回答1:


You could have only one app for both if it's easier for you. I would then suggest you configure config/routes.rb to respond differently according to the domain name.

See another answer about it here: Rails routing to handle multiple domains on single application

And the Advanced Contraints in Rails here: http://guides.rubyonrails.org/routing.html#advanced-constraints



来源:https://stackoverflow.com/questions/14693542/show-one-application-on-2-site-with-different-front-ends-but-same-back-end-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!