I am currently working through the Rails Tutorial by Michael Hartl and have run into an error I can’t understand.
There is a section where the tutorial explains how to create custom URI’s in the routes.rb file. The tutorial explains that by coding this:
match '/about', to: 'static_pages#about'
named routes should automatically be created that look like this:
about_path => '/about'
about_url => 'http://localhost:3000/about'
The following section then helps you work through fixing up rspec tests by replacing certain bits of code with these variables. But when I do this, I end up failing every test because all the “automatically created variables” can’t be found…
Can anyone explain to me why they aren’t being found or where I can look to see if they were in fact created already.
As far as I’m aware, if you do not use
as:, you do not get a named route. See the guides for more info.In your example, you could do the following: