Following 2 statements look identical to me, however the first one returns only one object but the second one returns correctly an array of 4 objects.
What is happening here is simple, I get all the Grade objects (1st one using Grade.find(:all) and second one using Grade.all), and then filter out all the grade objects where they have worksheets assigned to them. * * *@grades = Grade.find(:all){|grade| Worksheet.find(:all,:conditions=> ['grade_id =?',grade.id]).count > 0}* * * *@grades = Grade.all {|grade| Worksheet.find(:all,:conditions=> ['grade_id =?',grade.id]).count > 0}* Can somebody explain why the results would be different for these 2 statements. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.