Skip to content

Instantly share code, notes, and snippets.

@beaucollins
Created November 11, 2009 18:40
Show Gist options
  • Save beaucollins/232188 to your computer and use it in GitHub Desktop.
Save beaucollins/232188 to your computer and use it in GitHub Desktop.
@results = Product.find(:all, :conditions => conditions, :order => 'weight ASC, id ASC').inject([]) do |result_array, product|
result_array << {:product => product, :shoe_sizes => product.shoe_sizes.find(:all, :conditions => ["min_weight >= ? AND max_weight <= ?"])}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment