V
V
Valery Semenov2012-07-27 18:57:04
Ruby on Rails
Valery Semenov, 2012-07-27 18:57:04

How to organize a project on RoR so that it would be used by two different hosts?

There are two hosts (url1 and url2). They are closely related - they use one gem file and models and settings. how to organize a rails project so that they both refer to the same project. Do not create two projects for each.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Riateche, 2012-07-27
@Ravall

1. Redirect requests from both domains to the same rails server. The steps required to do this are highly dependent on how the server is configured. If you are working on localhost, you need to write ip 127.0.0.1 for both hosts in the hosts file, and then go to host1:3000 and host2:3000 in the browser (assuming that you are using the built-in web server on a standard port).
2. In routes.rb, write routes for both sites, and specify the corresponding host for each route, as shown here .

A
Anatoly, 2012-07-27
@taliban

I don't understand anything in ROR, but what's the problem actually? Set both domains to the same directory and... it won't work?

R
Renat Ibragimov, 2012-07-27
@MpaK999

As you understand, two domains look at the same application, but they should display different data.
It depends on what you want to share:
- the database, then catch which host, according to it the corresponding connection config
- by hosts, you also share the folder where users load their resources
- you should also separate the view and asset files

P
porzione, 2012-07-27
@porzione

As an option to the above, deploy from capistrano to two different servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question