...

/

Associations Using External Data

Associations Using External Data

Learn how associations work with changesets using external data.

We’ll now look at how to create a changeset with associations when the data comes from an external source. We will use the following:

  • Forms presented to the user
  • Uploaded spreadsheet
  • Data posted to an API endpoint and so on

Earlier, we saw that we create new changesets using change or cast, depending on where the data came from. Similarly, we use put_assoc for internal data (as we saw in the last section) or cast_assoc for external data. This section will look at cast_assoc in more depth.

Creating new Records with associations

Let’s start with the case of adding a new parent record with new child records. As we did when we learned about the cast, we’ll assume that ...