rails raw sql example -
how can convert code raw sql , utilize in rails? because when deploy code in heroku,there request timeout error.i think faster if utilize 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)
you can this:
sql = "select * ... sql query here" records_array = activerecord::base.connection.execute(sql)
records_array
result of sql query in array can iterate through.
sql ruby-on-rails
No comments:
Post a Comment