For my rails 6 application in my routes.rb
, I have
Rails.application.routes.draw do
root 'pages#home'
end
and in my pages_controller.rb
, I have
class PagesController < ApplicationController
def home
end
end
and I have views/pages/home.html.erb
created.
However, when I start my rails server, I still get
PagesController#home is missing a template for request formats: text/html.
How do I solve this?
Edit:
It works if I do
class PagesController < ApplicationController
def home
render file: './app/views/pages/home.html.erb'
end
end
but I don't think I am supposed to do this.
The problem is resolved when I started the server using the windows command prompt rather than windows powershell
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.