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

Passing Data Between Controllers

At this point, we’re using a hardcoded value for cardholder_id, but we haven’t explained what it is. In our simulated payment processor back end, we need to pass an identifier of whose credit card information we want to show.

For the sake of simplicity, let’s assume that, elsewhere in our hypothetical system, when we create credit card info with our payment processor, we explicitly state that the cardholder’s ID is the same as our internal ID used in the CUSTOMERS table. Thus, the value we get back from our controller as customer_id should be the value to use for the cardholder_id.

Given that, how can we get the ID of the customer we’re viewing inside CustomerCreditCardController? We could extract it from ...

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