简体   繁体   中英

How does a rails server know which route.rb to use?

I'm currently learning rails following this tutorial: https://www.railstutorial.org/book/beginning#sec-the_hello_application

Here's what I've done.

  1. Create a new workspace in Cloud9.
  2. Use the rails new hello_world to create a new rails application.
  3. From there configure routes.rb, application_controller.rb etc.
  4. Create a new application in the same work space using rails new sample_app
  5. Muck around changing stuff here as well.
  6. Change to the hello_world directory, our directory is /workspace/hello_world.
  7. Open new terminal, run rails server -b $IP -p $PORT
  8. This successfully deploys a webapp, but when I access it shows the application from my sample_app application.

How do I specify which application I want to deploy?

Make sure you are in the right directory. You have created two applications in the same directory, so make sure you are starting the server from /workspace/hello_world

You need to navigate to Cloud9/hello_world to run the server on it.

Or Cloud9/sample_app to run the server on it.

You might have created sample_app inside hello_world in which case to run it you will need to navigate to Cloud9/hello_world/sample_app to run it on the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM