Saturday, December 3, 2011

[Rails] check hash content ?

hi,
how can I make sure that 'customer_student' won't be pushed twice to the
hash in the following example ?

@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_attendees << customer_student
end
end
end unless params[:term].blank?

appreciate any help.
Thank you
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate