I have two models, History and SalesOrder, which are setup like this:
class History < ActiveRecord::Base
belongs_to :sales_order
end
class SalesOrder < ActiveRecord::Base
has_many :histories
has_many :latest_history,
:class_name => “History”,
:order => “id desc”
end
Is it possible to use a where clause when finding SalesOrders that is
based on History? For example:
orders = SalesOrder.find(:all, :order => ‘latest_history asc’)
Is that kind of thing even possible with Active Record?