Recently, I had one little problem regarding Ruby and Processing POST
requests from a HTML form.
I know that there is Webrick for Servlets and stuff, but I want to know,
there is possible to process POST/GET requests with basic net/http and
mod_ruby?
I have one ruby script that receive some data from one html page
POST/GET.
I want to display or use in other scope these parameters.
How can this be done ?
I have one ruby script that receive some data from one html page
POST/GET.
The easy way is to make a new CGI object in your script, that mod_ruby
runs, and ask for the parameters, POST-ed ones will be there, too.
E.g: in your ruby script file:
require 'cgi'
cgi = CGI.new
get_data(cgi)
def get_data(cgi)
user = User.new
User.name = cgi['name']
User.age = cgi['age']
...
end
Thanks Parragh,
Great help, with one small notice:
I used exactly your example, BUT I called the method get_data, after
declaration of it, because if I call it before, I'll get 500 Internal
Server Error.