Topic: Sort Order with Relationships
I've got a couple models for orders and lines.
class Order < ActiveRecord::Base
class Line < ActiveRecord::Base
When I try to do something like:
@order = Order.find_by_id(params[:id])
@lines = @order.lines
What is the most efficient way to sort @lines? I'd like to sort it by the product and cost columns in the lines table. Thanks,