I'm getting the "NameError" after doing the following in routes.rb
get '/help', to: 'static_pages/help'
get '/about', to: 'static_pages/about'
get '/contact', to: 'static_pages/contact'
get '/sigunup', to: 'users#new'
Showing /home/bdme551/bdme21/app/views/layouts/_header.html.erb where line #7 raised:
undefined local variable or method `help_path' for #<#<Class:0x007f7474f3d208>:0x007f747555c508>
Extracted source (around line #7):
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", help_path %></li>
<li><%= link_to "Log in", '#' %></li>
class StaticPagesController < ApplicationController
The problem is you haven't defined a name for your custom
GET route. If you run
rake routes, you should not find a
prefix for any route except
You can add a name to a custom route with the
get '/help', to: 'static_pages#help', as: :help
Note that in your code you have
static_pages/help as the value for
It should be
# refers to instance method.
Now, if you try to run
rake routes, you should find
help as a prefix for
Also, fix the other route definitions by replacing