G
Greg Ma
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_namefirst, :conditions => ["name LIKE ?",
"%#{tag}%"])
students = Student.findall)
students.each do |student|
students.delete(student) unless
students.tags.find_by_name(result.name)
end
students
end
Greg
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_namefirst, :conditions => ["name LIKE ?",
"%#{tag}%"])
students = Student.findall)
students.each do |student|
students.delete(student) unless
students.tags.find_by_name(result.name)
end
students
end
Greg