ruby-on-rails - Rails 的 localhost :“缺少请求格式的模板”?
问题描述
我是 Ruby Rails 新手,我正在尝试通过这个 Youtube 指南制作一个 Rails 页面
https://www.youtube.com/watch?v=pPy0GQJLZUM
当我关注页面时,我遇到了这个问题。当我尝试打开本地主机:localhost:3000 时,它给了我这个通知
PostsController#index is missing a template for request formats: text/html
在\app\views\posts
我有这样的index.html.erb
文件
<h1>Index</h1>
在\app\controllers\posts_controller.rb
我有这样的posts_controller.rb
文件
class PostsController < ApplicationController
def index
end
end
在\config\routes.rb
我有这样的routes.rb
文件
Rails.application.routes.draw do
root 'posts#index'
end
我是新手,对这个问题很困惑。请你帮助我好吗?非常感谢。
解决方案
推荐阅读
- r - ggplot中的Rscript无效字体类型
- java - 我如何在回收中首次启动应用程序时突出显示项目
- lua - 将变量分配给表
- php - Laravel 5.6 缓存存储了数千个值,都称为 :timer
- go - 如何为对象创建结构并在 golang 中获取值?
- haskell - printtype函数中的“代理a”是什么?
- java - 正则表达式密码至少一个字符来自三个 3 类别
- c++ - 我在 main 中的 argv[] 转换为整数时总是返回 0
- python - 熊猫:合并数据框但对重叠列求和
- graphql - 使用 apollo angular GraphQL 在 Drupal8 中添加用户