Ruby on rails 摘自迈克尔·哈特尔的书《路线》/静态“页面/帮助”;韩元';不显示

Ruby on rails 摘自迈克尔·哈特尔的书《路线》/静态“页面/帮助”;韩元';不显示,ruby-on-rails,railstutorial.org,Ruby On Rails,Railstutorial.org,每当我尝试导航到, 它不会更改为此视图。它只是继续显示根路由 请有人指出我做错了什么 class StaticPagesController < ApplicationController def home end def help end end class ApplicationController < ActionController::Base protect_from_forgery with: :exception def hello

每当我尝试导航到, 它不会更改为此视图。它只是继续显示根路由

请有人指出我做错了什么

class StaticPagesController < ApplicationController
  def home
  end

  def help
  end
end


class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
    def hello
    render html: "hello, world!"
    end
end

Rails.application.routes.draw do
  get 'static_pages/home'

  get 'static_pages/help'

  root 'application#hello'
end
class StaticPagesController
尝试指定相关控制器,完成后,没有理由不执行以下操作:

Rails.application.routes.draw do
  root 'application#hello'
  get 'static_pages/home', to: 'static_pages#home'
  get 'static_pages/help', to: 'static_pages#help'
end

我不知道是否每个人都这样做,但我似乎更喜欢把根放在上面。

我尝试过…amazon.com静态页面/help和just/static页面等