at the moment, my nav-bar content looks like this:
<li><%= link_to "Portfolio", projects_path, :class => "header" %></li>
<li><%= link_to "Articles", posts_path, :class => "header" %></li>
<li><%= link_to 'Contact', contact_path, :class => "header" %></li>
The first two links work fine, but the last one doesn't. How do I refer correcty? The contact page is just a simple, static page (no projects, or blogs that get pushed).
This my routes.rb
Rails.application.routes.draw do
resources :contact
get 'contact/index'
resources :posts
resources :projects
get 'welcome/index'
root 'welcome#index'
end
And this is the controller
class ContactController < ApplicationController
def index
end
end
If I take a look at the rake routes, I am get this:
contact_index GET /contact(.:format) contact#index
POST /contact(.:format) contact#create
new_contact GET /contact/new(.:format) contact#new
edit_contact GET /contact/:id/edit(.:format) contact#edit
contact GET /contact/:id(.:format) contact#show
PATCH /contact/:id(.:format) contact#update
PUT /contact/:id(.:format) contact#update
DELETE /contact/:id(.:format) contact#destroy
GET /contact/index(.:format) contact#index
I am new at ruby and I am looking forward to help. Thanks already in advance!
Replace your third line with following line:
<li><%= link_to 'Contact', contact_index_path, class: "header" %></li>