In recent days been doing a lot of ruby, which means i tend to use Active Record as well. I had written some scripts where i was selecting records that matched a criteria such as: @table1.table2s.select{|e| e.column_name == 1234} but as i need to sort my result and also give some more conditions to filter the data, i need alternatives to this above query and i ended up with the two lines of code below: