I have a rails app, with sale which has_may :line_items. I'm trying to pull from the database if the line item are express_production. But it always return all the sales. sls = Sale.in_between(Date.today - 30, Date.today).order("ordered_on DESC") @sales = sls.select do |sale| sale.line_items.select{ |l| l.express_production } end But it return every sale even when they have express_production = false. Could anyone help me. Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/04543175-c5c3-48d2-8ae0-90c5bf942105%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.