How to Add New Item to App Made Using the phx.gen.html Generator
From ElixirBlocks
This page is in progress
This document explains how to retroactively add a new table field to your app when your data was created using the phx.gen.html generator. It explains how to update your code so that it appears the data was created with the initial generator command in your controllers, tests and html pages.
First, you need data that is generated. An example is:
mix phx.gen.html Testbeds Testbed testbeds name:string
After the code is generated, you are asked in the console to set a route for the items.
resources "/testbeds", TestbedController
The items are viewable in your app by going to:
http://localhost:4000/testbeds
To add a new field you first update the Schema and then run a migration. This updated the database.