I tend to prefer code like:

@class.enrolled_students.each do |student|
   student.name
end

as Philip mentioned.

Enrolled students, if I understand your model(s) correctly, are just a 
specialized set of students. Not dropped_students, or 
withdrawn_students, or waitlisted_students, or students_on_hiatus, but 
those currently enrolled in the class.

The ".each do |call it whatever|" gives you the chance to map the 
'enrolled_students' back to their source, and pretty much anyone reading 
the code will make the leap (however small) that 'name' is an attribute 
or method of the 'student' class.
-- 
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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to