Rails 3 cannot find static page path

I am working on a Ruby on Rails Tutorial: Learn Rails as an example. I am in the section "Static pages are more likely."

I get an error after creating an HTML page in a public directory called public / hello.html and should look like Figure 3.3. My problem is that when I try to create a page and make it visible on localhost: 3000 / hello.html, I do not see the page being displayed. Instead, the error message "Routing error No route matches" /hello.html "appears

I did not make any changes to the routing; I thought Rails had to be smart enough to find "hello.html" because it is in the same directory as the page "public / index.html" and the name of the page is "hello.html"?

Could you explain?

+3
source share
5 answers

If you are like me and are included in the book, I left the server running from the previous chapter, so it still downloaded index.html from the demo_app directory.

+4
source

You follow the old guide. Newer version

http://ruby.railstutorial.org/chapters/static-pages#sec:green

reports that you need to change route.rb in the config folder. I sat for about an hour, crying about it.

+1

, ? , "localhost: 3000/[space] hello.html", "localhost: 3000/hello.html". , .

0

. .

, , , Rails . , , . , , .

0

, ( ):

C:\Users\Nnamdi\rails_projects\sample_app\Public\hello.html

, , .. ...

0

Source: https://habr.com/ru/post/1771219/


All Articles