Hi, I am newbie in Ruby.
Here is the situation I meet:
method to another ruby app.
Here is the url: http://localhost:3000/home/receive_data
So, the ruby app got a home controller and receive_data action to
It will write log when receive_data action works just like the
following code does:
render :text => "ok"
GET, then it will get logs.
It means the action in controller only can handle a request of GET
How should I do, if I wanna receive data from POST method?
normally Rails takes care of this automagically, and it doesn't matter
to an action whether the data comes in as GET or POST - in both cases,
the data is accessible through the params method.
If you're not getting anything in the logs, I would try to locate the
app. If all else fails, have you tried POSTing to the action manually,
via wget or with a hand-built HTML form?
Out of sheer interest, what's 'trace'? Sorry if this is an obvious
question, but I am slightly hungover at the moment ..
Sorry! I forget to explain the trace function. In fact, it works just
like "puts" with a additional timestamp log at head. Here it is:
def trace(str = '')
p "["+Time.new.to_s(:db)+"] ***** "+str.to_s
When I test it again today, it shows up the error like below (I didn't
alert it before):
After known what the error it is, I already found the solution in this
I override the verifiable_request_format? method in controller, then
the receive_data action works just as I expected.
Thank for yor help any way!