title: Writing SQL in Rails 4
body: <p>I have a payment_request model and a payment_detail model. In the payment_request index I need to be able to search by first and last name which are stored in the payment_details table. I am newish to writing SQL and could use some help. I have what I believe to be the correct query below, but am not sure how to write that in my Rails controller so I can search by name.</p>
  
  <pre><code>SELECT first_name, last_name
  FROM payment_details
  LEFT OUTER JOIN payment_requests
  ON payment_requests.id = payment_details.payment_request_id;
  </code></pre>