[Rails] Re: Iterate over a set of classes

2014-04-11 Thread Maese
B.where(a_id: @As) 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| @Bsa.bs end El jueves, 10 de abril de 2014 23:20:53 UTC+2, Ruby-Forum.com User escribió: I have class A and B. A has many Bs. B has a field

[Rails] Re: Iterate over a set of classes

2014-04-11 Thread Ignacio Toscano
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| @BsB.where(a_id: a, is_visible: true) end -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Re: Iterate over a set of classes

2014-04-11 Thread Maese
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| @Bsa.bs.select{ |b| b.is_visible} end El jueves, 10 de abril de 2014 23:20:53 UTC+2,

[Rails] Re: Iterate over a set of classes

2014-04-11 Thread Matt Jones
On Friday, 11 April 2014 07:13:25 UTC-4, Ruby-Forum.com User wrote: 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|