From: "Jesús Gabriel y Galán" Date: 2009-09-08T23:02:49+09:00 Subject: Re: accessing Name and value pair using "Sinatra" On Tue, Sep 8, 2009 at 2:20 PM, Ken Ghosh wrote: > Jesús Gabriel y Galán wrote: >> On Tue, Sep 8, 2009 at 9:00 AM, Ken Ghosh wrote: >>> Hello everyone, >>> >>> � I currently using Sinatra nad i must say its great. >>> � But I am currently stuck i wanted to passes a Name,value pair >>> � as a parameter to sinatra >>> >>> � something like this >>> � http://localhost:4567/multiQuery?&Name_1='ABC'&Name_2='XYZ'&Name_3='LMN' >>> >>> � so that i can directly access values 'ABC','XYZ' and 'LMN' >> >> There's a params attribute in Sinatra::Base that contains the query >> string: >> >> This route: >> >> get '/hello/:name' do |name| >>         "Hello, #{name}. #{params.inspect}" >> end >> >> when called as: >> >> http://localhost:4567/hello/x?a=3&b=4 >> >> produces: >> >> Hello, x. {"name"=>"x", "a"=>"3", "b"=>"4"} > can i get only parameters after the question '?' >  e.g >   http://localhost:4567/hello/x?a=3&b=4 > as >  {"a" => "3","b" => "4"} Yes, you get also the name because the route contains variables. If you change it to: get '/hello/x' do "Hello, . #{params.inspect}" end Jesus.