Read paramater from request

how to read variable value from request dynamically
i.e.

request contains variable with these names 1,2,3,4,5…,n

how to read these variable with loop
i tried this code but it doesn’t work

i = 1
while (input=params[:’#{i}’] != nil)
puts input
i = i +1
end

please i want the right code

thx

Mohamed wrote:

puts input
i = i +1
end

please i want the right code

thx

Try

params.keys.sort.each do |key|
puts params[key]
end


http://www.5valleys.com/

thanks (Y)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs