开发者

No Route matches "say/hello" when route exists

开发者 https://www.devze.com 2023-03-14 10:30 出处:网络
I\'m trying to create a very simple Hello, world program in RoR, but when I go to view the url http://localhost:3000/say/hello I\'m getting the error message No route matches: \"say/hello\"

I'm trying to create a very simple Hello, world program in RoR, but when I go to view the url http://localhost:3000/say/hello I'm getting the error message No route matches: "say/hello"

I started with: rails generate controller Say hello goodbye which lists route get "say/hello"

Also: I'm having this problem which is probably related. When I go to write some basic html in one of the files that is clearly listed as existing I get this:

I write this:

~/work/demo$ /app/views/say/hello.html.erb

Get this error message in return:

bash开发者_如何学运维: /app/views/say/hello.html.erb: No such file or directory

What's going on here? I'm getting these instructions straight from Agile Development with Rails and it's so simple.


With the details you've given I'm not sure why your route can't be found.

However, I believe the reason you're experiencing the no such file or directory error is because you're typing /app/views/say/hello.html.erb. Try removing the leading slash, so that it reads app/views/say/hello.html.erb. Bash appears to be parsing the former path as an absolute path, instead of a path relative to your current working directory.


What is this command?

~/work/demo$ /app/views/say/hello.html.erb

you should be using your web browser: http://localhost:3000/say/hello

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号