I am doing the very intro course in rails, and so far have completed the following
- Made a new rails app:
rails new shovell(“shovell” is the name of the app) - Installed all the gems and what not:
bundle install - Generated a model
rails generate model Story name link - Generated a controller
rails generate controller Stories index
And now when I point to http://localhost:3000/stories, I get a error that says “Routing Error
No route matches [GET] “/stories” “
And the following is my routes.rb:
Shovell::Application.routes.draw do
get "stories/index"
# a bunch of comments
end
So I don’t know what Im doing wrong, and why its not showing up the default welcome message, but rather giving me an error. Thanks for your help!
However, if you do:
you may get the page, although that’s not the rails way.
First thing, read and understand the rails routing guide
Then in order to fix your code, on the routing you can write
Or if you want custom routes instead of a rest resource
And you can also name the custom route
So with a name you can use the route name on your rails app