Ups i forget the visible condition B.where(a_id: @As, is_visible: true)
if you have a massive amounts of Bs the Data Base server will hate you,so a better solution is @Bs=Array.new @As.each do |a| @Bs<<B.where(a_id: a, is_visible: true) end -- Posted via http://www.ruby-forum.com/. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c29abc2e6ae717ee874cf0d9331a8c7a%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.