The rails version is 2.3 I have a relation offers hm prices In the prices table a have a column named well base_price, + promotion and last_minute The prices for one offer can have promotion checked or last_minute checked indicating that the current price is a promotion or last minute, to find out if a offer is a promotion or last_minute, and view that in the search results I need to get the lowest price from prices belonging to the offer and check if its marked last_minute or promotion right now I''m doing this way to find promotions Offer.all(:conditions=>{:published=>true}).collect {|c| offers << c if c.min_price.promotion? } and I know this is counter productive way of searching but I couldn''t find a way to do that, my best guess was to use pure SQL but then I''m not that good at it (i was going for something find all where base_price is minimum and promotion is checked | last_minute is checked and group it by offer_id). any help would be appreciated -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.