I’m using find_by_sql in my barcode model and I want to use the
will_paginate plugin with it. will_paginate works like a find
replacement so I need to modify this code to use a regular find method
instead of find_by_sql.
self.find_by_sql(“select * from barcodes inner join items on
barcodes.item_id = items.id inner join item_types on
items.item_type_id = item_types.id where barcodes.client_id = " +
client_id.to_s + " order by item_types.name, items.name”)
Barcode belongs to Item
Item belongs to ItemType
The reason for this find_by_sql is that I want the barcodes sorted
first by item_type.name then by item.name.