if include three statments ruby or compare arrays? -


my code lists documents in folder:

arr = []  file = dir.entries('c:\sites\what\upload').reject{|entry| entry == "." || entry == ".."} file.each |f| = file.read('c:\sites\what\upload' + '/' + f) + f 

and searches files patient.name, patient.vorname, , patient.birthday present. if so, program assigns document patient:

@patients.each |patient| if a.include?(patient.name) || a.include?(patient.vorname) || a.include?(patient.birthday) 

my program somehow assigns documents users have nothing documents or better said, not mentioned in text. think problem if statement wrong.

would better if split text before , compare new array [patient.name, patient.vorname, patient.birtday]?

arr << patient.id first = patient.find_by_id(patient.id) second = first.images.create(:url => 'c:\sites\what\upload' + f)  end end end 

try below:

if [patient.name,patient.vorname,patient.birthday].all? {|i| a.include? } 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -