Its foundational to understand how MVC works in Rails. Once this concept is understood it will make it very easy for anyone to create and design their own application. Rails convention over configuration concepts will start to play a big role in the MVC workflow.

We start off by generating the controller

# this will generate the posts_controller.rb
rails g controller posts

Once we run the above command it will give us a few files, the one to note is the posts_controller.rb

class PostsController < ApplicationController

end

The next thing we will need to do is add resources to our config/routes.rb

Rails.application.routes.draw do
  resources :posts
end

By running rake routes you'll see how it maps to each of our controller actions.

            posts GET    /posts(.:format)                            posts#index
                  POST   /posts(.:format)                            posts#create
         new_post GET    /posts/new(.:format)                        posts#new
        edit_post GET    /posts/:id/edit(.:format)                   posts#edit
             post GET    /posts/:id(.:format)                        posts#show
                  PATCH  /posts/:id(.:format)                        posts#update
                  PUT    /posts/:id(.:format)                        posts#update
                  DELETE /posts/:id(.:format)                        posts#destroy