简体   繁体   中英

How to fix index is missing a template for request formats: text/html

I'm following a udemy course with Rails and I've also tried following the guidance in " Getting Started with Rails ", but no matter what my application can't locate my template files.

app/controllers/welcome_controller.rb:

# frozen_string_literal: true

# The welcome controller.
class WelcomeController < ApplicationController
  def index; end
end

app/views/welcome/index.html.erb:

<h1>Hello, Rails!</h1>

config/routes.rb:

# frozen_string_literal: true

Rails.application.routes.draw do
  get 'welcome/index'
  root 'welcome#index'
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end

删除此行获取 'welcome/index' 或简单地将其更改为获取 'welcome/index',改为:'welcome#index' 希望这可以解决您的问题。

I worked out what the issue was. My mounted drive was called "HDD (Mint)" changing it to "HDD-Mint" and now it's working perfectly!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM