It was time for my annual googling to figure out the answer to "return ActiveRecord objects from a raw SQL query that uses bind params". The answer, which I will forget in 5 minutes, is still: User.find_by_sql(['select users.* from users where id = :user_id', {user_id: 1}])
-
-
TIL! I just paste what stackoverflow tells me to ok
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.