Hassan Schroeder wrote in post #1034918: > On Sat, Dec 3, 2011 at 8:22 AM, Dani Dani <[email protected]> wrote: > >> how can I make sure that 'customer_student' won't be pushed twice to the >> hash in the following example ? > > What hash? > >> @potential_course_students = [] >> @selected_customers.each do |customer| >> customer.customer_student.each do |customer_student| >> if customer_student.display_name.include?(params[:term]) && >> ! @potential_course_students.include?(customer_student) > > @potential_course_students is an empty array; how would it include > anything at that point? > >> @potential_course_attendees << customer_student > > @potential_course_attendees isn't defined in your snippet -- ?? > >> end >> end >> end unless params[:term].blank? > > -- > Hassan Schroeder ------------------------ [email protected] > http://about.me/hassanschroeder > twitter: @hassan
the variable: @selected_customers includes already the potential students. didn't show all code. Thanks Dani -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

