title: Query as table in rails
body: <p>hi guys i need some help, how do you create this query in rails controller?</p>
  
  <p>SELECT * FROM (SELECT id,amount,user_id FROM payments
  WHERE user_id='10000' ORDER BY id DESC) WHERE rownum &lt;=1;</p>