Just add them into the options for the url_for and you should be in
business. No need to do the conversion first. However, looking at your
example. It seems like donate should be a method of a controller and not
the
controller itself. You’d probably be better off with a Contributions
controller [which could provide an index of people who have donated
previously as well as other methods] and just using a CRUDdy new/create
kind
of methodology. At any rate, adding :amt => “400.00” to the options
parameter in url_for will place amt as a parameter in the url.
My scenario was actually a manual HTTP request (see below). I was
interested in whether there is an existing ruby or rails method to
convert
the hash to a string (in the form of a URL parameter string)? I know I
can
do this manually in ruby quite readily, but just very curious to know
whether there is a method already there to do it in one hit?
postData = {"cc"=>"USD", "st"=>"Completed" } #<=== Doesn't seem to
work, needs to be a string
responseString = “”
Net::HTTP.start(uri.host, uri.port) do |request|
responseString = request.post(uri.path, postData).body
end
Greg
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.