Saving Data Back to the Server

Normally, saving back to the server wouldn’t be terribly interesting, since we could just post a JSON blob that Rails expects to be given to an Active Record’s update method. If you’ll recall, our CustomerDetail class is backed by a materialized view and not a regular table. That means that we can’t call update on it, since you can’t update a materialized view.

That means we’ll have to figure out how to get the data out of our denormalized CustomerDetail and into the right places in the database. But first, let’s get our Angular app and Rails back end set up to receive the data.

Sending Data Back to the Server

First, let’s set up the update action for CustomersController, which is what will receive the payload ...

Get Rails, Angular, Postgres, and Bootstrap now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.