Rails tutorial chapter3 heroku cannot find controller StaticPagesController

六月ゝ 毕业季﹏ 提交于 2020-01-06 04:36:04

问题


I have a page doesn't exist problem with my sample_app from the tutorial. I just followed all the steps and my code looks like this:

Routes

Rails.application.routes.draw do
  root 'static_pages#home'

  get 'static_pages/home'

  get 'static_pages/help'

  get 'static_pages/about'

  get 'static_pages/contact'
end

Controller - the file name is static_pages_controller.rb

class StaticPagesController < ApplicationController
  def home
  end

  def help
  end

  def about
  end

  def contact
  end
end

On GET "/" i'm getting

ActionController::RoutingError (uninitialized constant StaticPagesController)

It looks like it cannot find my controller.

Thanks for any help Andrej

来源:https://stackoverflow.com/questions/48246304/rails-tutorial-chapter3-heroku-cannot-find-controller-staticpagescontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!