Hello all,
I am trying to figure out how to do this with find instead of doing it
via find_by_sql
For example I am trying to list all my completed orders, however I need
to check the progresses table to make sure the “currentlevel” in the
progress table equals
“endlevel” in the orders table.
The sql below works fine, but I am just curious how to do it another
way.
def completed
@orders = Order.find_by_sql ("SELECT * FROM orders, progresses WHERE
orders.id = progresses.user_id AND orders.endlevel =
progresses.currentlevel AND orders.process =1 ")
end