我的用例很简单。这是我的模型。
Auction
===============
id
name
expiration_date
AuctionImage
===============
id
auction_id
image_path
filesize
我想得到所有Auctions
至少有 1AuctionImage
的东西,然后按expiration_date
.
class Auction < ActiveRecord::Base
has_many :auction_images
end
class AuctionImage < ActiveRecord::Base
belongs_to :auction
end
有什么建议么?