我正在研究 Michael Hartl 的The Ruby on Rails Tutorial的第 10 章中的练习 3 。
我正在重构 app/views/static_pages/home.html.erb 中的代码并将其移动到两个部分中:
- app/view/static_pages/_signed_in.html.erb
- app/view/static_pages/_non_signed_in.html.erb
并在两个文件上调用渲染。出于某种原因,我收到此错误:
ActionView::Template::Error:
Missing partial static_pages/non_signed_in, application/non_signed_in with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw , :ruby, :jbuilder, :coffee]}。
但是,当我将这两个部分移动到同级目录 app/view/static_pages/shared 并告诉渲染查看那里(即“render 'shared/signed_in'”和“render 'shared/non_signed_in'”)时,错误消失了。想法?
谢谢!!