Action Controller is missing a 'template' for request formats

Hey! I am kind of stuck on this problem with getting started with Rails. The thing is, I’ve previously not had this problem. I was following this guide: and everything worked fine up until 30 minutes in and only some text was being shown on the screen (one h1 tag but not my p tag). My controllers worked with my views and the server ran well but then I started messing with something in the db folder in one of my rails projects and now I get this:

  1. Here is the github link with relevant files to the question first:

  2. I deleted all projects and created new ones. Here is the data from the recently configured rails project:

    • found in github file: railsfile
  3. Here is what I get when I start the server AND navigate to the home page

    • found in github file: serverinfo
  4. Now I create my posts_controller output in:

    • found in github file: postController
  5. Now I right click the ‘posts’ folder inside of the views folder and create an index.html.erb file.

  6. After that I populate the file with a paragraph tag and save it.

  7. After that I go into the posts_controller.rb file and define an action called index.

  8. After that I go into the config folder and into the routes.rb file and declare my root to be the posts controller and the index as the action.

  9. Now I refresh and get the error I had above here is what the server said:

    • found in github file: servererrorinfo

Hey, thanks for reading it all. I hope I have given enough information. I have googled questions with the same answer but none of the stuff is relevant to what is going on. I am having an issue with the controller reaching the index.html.erb file. It’s saying it’s not there, I looked over the rails project creation files and it said something like request is deprecated. Could it be something with a model? I did everything(that I know of) that the guy said on the video, and it doesn’t work for me. Thanks for the help.

Here’s the compiled image to help out:

The problem is that you create the posts controller, but you didn’t create the index action.
Try with:

 rails g controller Posts index

instead of:

rails g controller Posts

If you are going to generate the index action manually, then you must also create an index.html.erb file inside the app/views/posts directory( This is the cause of you error)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs