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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access