post request rails link_to

First, you need to create a form with the link_to helper in your view file. The link_to helper should have the text "Create New Post" and the path for the new action of the controller as its arguments.

Next, in your controller, define the new action to create a new instance variable of the model you want to work with.

Then, create a private method in the controller to permit the required parameters.

After that, in the view file, use the form_with helper to create a form for the model. The form should have the attribute 'method: :post' and 'url: posts_path' as its arguments.

In the create action of the controller, define the logic to save the new post using the permitted parameters.

Finally, in the routes.rb file, use the resources method to create the routes for the posts. This will generate the necessary routes for the post request.