Refactoring Help

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.

def self.all(client_id)
self.find_by_sql(“select * from barcodes inner join items on
barcodes.item_id = inner join item_types on
items.item_type_id = where barcodes.client_id = " +
client_id.to_s + " order by,”)

Barcode belongs to Item
Item belongs to ItemType

The reason for this find_by_sql is that I want the barcodes sorted
first by then by

Nevermind, I figured it out.

self.find_all_by_client_id(client_id, :include => {:item
=> :item_type}, :order => “,”)

On Oct 22, 5:17 pm, “randomutterings…” [email protected]