Hello,


> Yes and now, I know what is wrong in your code but I do not know what you want.

I would like to generate a hash for the condition in my finder

a["profiles.name"] = "bolo"
a["profiles.age"] = "25"

Thanks for the tips
 a.inject([]){|rtCriteria,(k,v)| rtCriteria << "#{k} ='#{v}'"}.join(",
")

irb(main):017:0> puts rtCriteria
profiles.age ='25'
profiles.band ='bolo'
=> nil
irb(main):018:0>

The only problem i have. I would like something like that
profiles.age ='25' AND profiles.band ='bolo'

Can you help me again  ?

Thanks

> You probably want a string like this
> "bolo => 'toto', robert => 'titi'" for a hash.
> In that case try this
>
> result =""
> {:bolo => 'toto', :robert => 'titi'}.each{|k,v| result<< ", #{k} = '#{v}'"}
> result[2..-1]
>
> The *Ruby* way might be to use inject though
> {:bolo => 'toto', :robert => 'titi'}.inject([]){|a,(k,v)| a << "#{k} =
> '#{v}'"}.join(", ")
>
> If it is something else you want to achieve just tell us what the
> exact result should be.
>
> Cheers
> Robert
>
> --
> You see things; and you say Why?
> But I dream things that never were; and I say Why not?
> -- George Bernard Shaw