How can I convert this code to raw SQL and use it in rails? Because When I deploy this code in heroku, there is a request timeout error. I think this will be faster if I use raw SQL.
@payments = PaymentDetail.joins(:project).order('payment_details.created_at desc')
@payment_errors = PaymentError.joins(:project).order('payment_errors.created_at desc')
@all_payments = (@payments + @payment_errors)