Specify the SELECT and use the built in mechanism for the WHERE in Rails 3 -


is possible (rails 3) specify select part of rails query, , use regular in order write conditions?

something like:

model.find_by_sql("select blah blah table1 join table2 on...").where([conditions, params]) 

i think looking for:

model.select('table_name1.field1, table_name2.field2')      .joins('join table_name2 on (table_name2.table_name1_id = table_name1.id)')      .where([conditions, params]) 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -