Code with the Flow
Writing rails applications is often broken up between the frontend, routes, backends, and the database. It is a classic MVC framework.
The way I often write is writing the frontend first starting with the react components in the
Any fetch request in the frontend is then directed to the rails applications where the rails application looks at the routes.
In the routes file
config/routes.rb I configure the fetched route to go to a specific controller and from the controller I then make calls to the database.
It looks something like the following:
app/webpack/console.jsx -> makes a fetch request to
config/routes.rb takes the request -> directs it to a view or controller depending on the controller data
data#index method in the controller with a code block calling to the ORM
ModelName < ApplicationRecord
Start from the frontend and work your way through the application. When one piece is complete, move to the next frontend component.