O'Reilly logo

Rails, Angular, Postgres, and Bootstrap by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required