PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

C'è un modo per passare i parametri alla query grezza postgres in rails?

Prova find_by_sql :

Post.find_by_sql(["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date])

[#<Post:0x36bff9c @attributes={"title"=>"The Cheap Man Buys Twice"}>, ...]