From: Greg Ma Date: 2010-02-16T14:47:08+09:00 Subject: Find by association table Hi, I did a the method below that return all students who has the method parameter in their tags collection. I am sure this is pretty by coded, could someone help clean it up please :) #method def find_student_by_tag(tag) result = Tag.find_by_name(:first, :conditions => ["name LIKE ?", "%#{tag}%"]) students = Student.find(:all) students.each do |student| students.delete(student) unless students.tags.find_by_name(result.name) end students end Greg -- Posted via http://www.ruby-forum.com/.