I was thrown into the fire yesterday. Here’s a checklist so you can cry tears of joy instead of suffering.
go from this
or even this
create and fill the db/migrate/ migrations rb files that inherit from ActiveRecord::Migration
run rails db:migrate. You will see in the terminal if they were successfully created or if there was an (probably syntax in the create_migration file) error.
confirm the db/schema.rb looks right
create and fill the db/seeds.rb files
run rails db:seed
use rails c or rails console (or database browser software) to confirm the database has been seeded properly.
add appropriate routes in config/routes.rb on the backend
create the app/models model rb files that inherit from ApplicationRecord which inherits from ActiveRecord::Base and designate any relationships
create the matching controllers inheriting from ApplicationController which inherits from ApplicationController:::Base
create and fill app/services/ serializer.rb file for the model
fill in matching controller actions in the corresponding controller.rb in app/controllers/ to pull data from the database and render json: with the data or with plain text string. no need for instance variables because we’re not passing the data to erb views.
run rails s to start up server
confirm at your local server address that the API is rendering data