Bolo tu es sur une liste de courriel anglais.
Si tu hésites de écrir en Anglais tu peux m’envoyer ça sans problème.
Si tu es alais en Anglais restes ici c’est une liste formidable.
Pour ce qui concerne ton problème j’ai un petit peu mal à comprendre
ce que ce code devrait faire, la method ne peut pas fonctionner comme
ça, (c’est Rails? dans ce cas la liste de courriels serait encore une
autre).
session et params ne sont définit nul part, mais je devine un petit peu:
Ne voudrais-tu pas écrire
session[:list_search_criteria] ||= Hash.new
ou à la limite
session[:list_search_criteria] = Hash.new unless
session[:list_search_criteria] && !
session[:list_search_criteria].empty?
session[:list_search_criteria].each {|key,value| rtCriteria = "
profiles.#{key} = ‘#{value}’" }
Attention rtCriteria n’a que la dernière valeur, je propose que tu ecrives
rtCriteria << “…”
if rtCriteria.blank?
puts rtCriteria
else #actions 1
end
le puts émet toujours “”, le sais-tu bien?
N’hésites pas à précisier tes questions Off List.
Robert
You see things; and you say Why?
But I dream things that never were; and I say Why not?
– George Bernard Shaw
array = {:bolo => “toto” , :bolo => “toto” }
Actually array is a hash and it has only one pair of values :bolo =>
“toto”
array.each {|key,value| rtCriteria = “#{key} = ‘#{value}’” }
You will habe rtCriteria =“bolo = ‘toto’” and not blank?, but blank?
is not Ruby, I believe it is defined somewere in the Rails libraries.
In Ruby you can use rtCriteria.strip.empty? I believe.
if rtCriteria.blank?
As I said above rtCriteria is not blank it’s value = “bolo = ‘toto’”
puts “rtCriteria is ok”
else
puts "rtCriteria is not "ok
end
I have always
rtCriteria is not ok
the if method was called before the each method
It was not, if it were rtCretieria might be blank indeed!
It’s more clear ?
Yes and now, I know what is wrong in your code but I do not know what
you want.
You probably want a string like this
“bolo => ‘toto’, robert => ‘titi’” for a hash.
In that case try this