I just started studying Rails and I need some help.
I executed the command rails g scaffold posts title:string description:string, and I have generated some pages and a controller.
Page localhost:3000/posts shows me all my posts.
Page localhost:3000/posts/new give me the form to create a new post.
How could I create a post from localhost:3000/posts page? My code here - github
Thank you a lot!
When you access the page
localhost:3000/posts, you basically are making aGETrequest to/postsroute. To create a new element, you must make aPOSTrequest to the/postsroute. So, you need to create a form using methodPOST, or use the javascript to make a background post request on the index.On terminal, you can exec
rails routesto check all the routes.