ruby-on-railshigh-voltage

high_voltage double URL routing error


I'm getting the following error when I routing in my app

Routing Error

No such page: pages/contact

The page does exist, I've noticed in the URL it says:

http://localhost:3000/pages/pages/contact So rendering double /pages/

Routes.rb

Rails.application.routes.draw do
  get 'pages/index' => 'high_voltage/pages#show', id: 'index'
  root :to => 'high_voltage/pages#show', id: 'index'
end

html.erb

<%= link_to 'pages/contact', :class => 'btn btn--sm btn--primary type--uppercase' do %>

It's important to note if I'm routing from index -> contact it's fine, however, if I route from another internal page such as about or team, it will double render in the URL

TIA


Solution

  • I was using the default rails routing system for High_voltage Default rails is:

        <%= link_to 'Privacy Policy', 'pages/about' %>
    

    When the proper routing for high_voltage is:

        <%= link_to 'About', page_path('about') %>  
    

    If i was already on localhost:3000/pages/about/ it'd try and render pages again as specified in the default rails link_to versus the high_voltage