I am having this unusual error where I have created the view, models, and controllers for a page with home and about views. I have also set the routes to point to the pages#home, but the view displays an error that the controller is missing a template. I do not know what to do. I am only practicing some parts of ruby on rails and now I do not know how to debug this issue. Kindly please help me in this matter.
routes.rb
Rails.application.routes.draw do
resources :subscriptions
resources :accounts
resources :payments
resources :clients
resources :pages
root ‘pages#home’
end
pages_controller.rb
class PagesController < ApplicationController
def home
end
Is it “app/views/page/home.html.erb” or “app/views/pageS/home.html.erb”? The file in the screenshot claims to be to be located in /page/, and the helper file is also named page_helper.rb. Did you generate those files and then renamed some of them to “pages” and forgot to restart the server?
I have changed the controllers and views to plurals to check if the results are different. The error is still the same it returns template missing error.
Something is happening that’s probably isn’t related to rails. Perhaps you are running your rails server in the wrong directory, not the one where you’re editing code. At a different path. Or something else very weird is going on with your filesystem. It must be something like that, because this issue shouldn’t happen.
Try deleting the files from app/view/pages, and re-creating them again. Also delete the code in routes, and PagesController and add it again (no copy/pasting). Feels like it could be some invisible or wrong character that sneaked its way into some filename or code somewhere.
Also, remove get "pages/show" from your routes.
For sanity, try creating another view and controller, and seeing if that works.