Rails View Record from Database
We will see an example to view data in an application.
Step 1 Create a new Rails application.
Step 2 Change your directory to save.
Step 3 Create a controller from the console.
Step 4 Create a model from the console.
Step 5 Go to app/controllers/products_controller.rb and write the following code.
Step 6 Run the following command:
Step 7 Go to app/views/products/index.html.erb file.
Step 8 Go to app/views/products/new.html.erb file.
Step 9 Start the server.
Step 10 Run it on localhost.
Next TopicRuby on Rails CRUD