Domanda

I've been struggling with this for a while. All links work correctly on my localhost, however, when I attempt to push it to Heroku, my browser returns "The page you were looking for doesn't exist."

My Paper Trail add-on shows this error:

ActionController::RoutingError (No route matches [GET] "/"):

Here is my routes.db

Portfolio::Application.routes.draw do

  # UI CONTROLLER SETUP
  if Rails.env.development?
    get 'ui/:action', controller: 'ui'
    get 'ui' => 'ui#index'

    get 'work/:action', controller: 'work'
    get 'resume' => 'pages#resume'

    root :to => 'pages#home'
  end

My homepage is located as home.html.haml within the pages folder nested within views. I've also attempted it as:

root 'pages#home'

Here is my pages_controller.rb

class PagesController < ApplicationController

  def home
    @no_main_link = true
  end
end

I can provide any other information as requested.

È stato utile?

Soluzione

Remove if Rails.env.development? with corresponding end from the routes.rb. You are getting error as routes are not defined for production environment. The routes should look like below:

Portfolio::Application.routes.draw do

  # UI CONTROLLER SETUP

    get 'ui/:action', controller: 'ui'
    get 'ui' => 'ui#index'

    get 'work/:action', controller: 'work'
    get 'resume' => 'pages#resume'

    root :to => 'pages#home'
end
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top