Simple referral system in rails
<p>I'm making a very simple referral system, but the issue I'm seeing is that I need to make two different calls to the DB with a single submit action and I'm not sure how to do that.</p>

<p>The general idea for the system is as follows:</p>

<ul>
<li>A visitor subscribes to the mailing list and receives an email with a referral link with some kind of query string parameter identifying them (e.g. www.domain.com?referrer_id=1)</li>
<li>When another visitor uses this referral link and signs up, I store a) the new subscriber's email address, and b) the referral information</li>
</ul>

<p>This would be stored in two tables:</p>

<ul>
<li><code>subscribers</code> table with <code>| id | email | referrer |</code></li>
<li><code>referrals</code> table with <code>| id | subscriber_id | referrals |</code>, where referrals is the number of times a subscriber has referred other subscribers</li>
</ul>

<p>Again, I'm wondering how to make two calls -- one for the new subscriber and one for the referral information -- with a single submit action. Or, if that's not the best approach, how to do this using best practices.</p>