現在rails tutorial3章を進めております。
scaffold でStaticPagesコントローラを生成し、出来上がったはずのstatic_pages/homeへアクセスしようとしました。
rails sでサーバを立ちあげ、static_pages/homeをURLの末尾に入力すると、なぜかデフォルトの「hello,world!」のページから切り替わりません。
特にエラーも出なくて、ただstatic_pages/homeを入力してもページが切り替わらない状態です。
言葉での説明が難しくて伝わりづらいかもしれませんが、static_pages/homeへページを切り替える方法がわかる方がいらっしゃいましたら教えていただけると幸いです。
routes.rb
Rails.application.routes.draw do
get 'static_pages/home'
get 'static_pages/help'
get 'static_pages/about'
root 'application#hello'
end
static_pages_controller.rb
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
end
回答1件
あなたの回答
tips
プレビュー