# Net::HTTP.post\_form got 200 but no INSERT INTO. How come? Ho

**URL:** <https://www.ruby-forum.com/t/net-http-post-form-got-200-but-no-insert-into-how-come-ho/67501>\
**Category:** Ruby\
**Created:** [September 4, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/net-http-post-form-got-200-but-no-insert-into-how-come-ho/67501 "2006-09-04T18:09:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arie\_Kusuma\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@Arie\_Kusuma\_A](https://www.ruby-forum.com/u/Arie_Kusuma_A)\
**Post date:** [September 4, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/net-http-post-form-got-200-but-no-insert-into-how-come-ho/67501/1 "2006-09-04T18:09:48Z")

</div>

Hello,  
I’m playing around with net/http and open-uri Ruby Libraries… I’m  
trying to post to my own rails simple new action method.

Here’s my irb :

irb(main):013:0\> res =  
Net::HTTP.post\_form(URI.parse(“[http://localhost:3002/blog2/new](http://localhost:3002/blog2/new)”),  
{“commit” =\> “Save”,  
“signature\_id” =\> “”, “signature\_content” =\> “hey rails, it’s me ruby,  
your lover, why can you not insert me”})  
=\> #\<Net::HTTPOK 200 OK readbody=true\>  
irb(main):014:0\>

Here’s the log (from rails)

Processing Blog2Controller#new (for 127.0.0.1 at 2006-09-03 09:13:55)  
[POST]  
Session ID: 1629fe20fc50bebad043d8f6cb6a7a83  
Parameters: {“commit”=\>“Save”, “action”=\>“new”, “signature\_id”=\>“”,  
“controller”=\>“blog2”, “signature\_content”=\>“hey rails, it’s me ruby,  
your lover, why can you not insert me”}  
Signature Columns (0.017050) SHOW FIELDS FROM signatures  
SQL (0.000317) BEGIN  
SQL (0.000310) COMMIT  
Rendering blog2/new  
Rendered blog2/\_form (0.00146)  
Completed in 0.06593 (15 reqs/sec) | Rendering: 0.02027 (30%) | DB:  
0.01768 (26%) | 200 OK [[http://localhost/blog2/new](http://localhost/blog2/new)]

How come i’ve got 200 OK , but i didn’t get my INSERT Query run ???  
How can i fix it?

Oh, btw here’s my new action method from my Blog2 controller

def new  
@signature = Signature.new  
return unless request.post?  
@signature = Signature.new(params[:signature])  
if @signature.save  
expire\_fragment(:action =\> “list”, :part =\> “signatures”)  
expire\_fragment(:action =\> “list”, :part =\> “count”)  
redirect\_to(:action =\> “list”)  
end  
end

I would be verry grateful 4 somebody who can give me a good solution for  
this.

ps.  
Actually i’ve posted this to Rails maillist but nobody answered …  
sigh … don’t whether my question’s too dumb or too difficult … so i  
consider it would fit to go into this ruby-talk maillist. Right now  
i’m playing with http-access2 library (from RAA)… but i’m still  
stuck on how to post like this. I actually need to do like Perl::LWP  
POST like this :  
cat /home/ariekeren/tmp/test-xml/2000.xml | POST -c “text/xml”  
[http://203.128.65.50:14013/cgi-bin/sendmyscript](http://203.128.65.50:14013/cgi-bin/sendmyscript)  
but i like to make it simpler in example above (this thread) to test  
whether i’m succeeded or not to post from ruby just like LWP POST in  
Perl.

–  
Name : Arie Kusuma A., A.K.A Arie, A.K.A ariekeren / YM! = riyari3  
[http://ariekusumaatmaja.wordpress.com](http://ariekusumaatmaja.wordpress.com)  
Let’s build Ruby Indonesia stronger

> **[Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos](https://www.yahoo.com/)**
>
> Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!

Go go go Ruby go!  
Mp3Info.open(“Linkin\ Park\ -\ Abyss.mp3”) { |f| puts f }

---

<div class="post-metadata">

**Author:** ![Arie\_Kusuma\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@Arie\_Kusuma\_A](https://www.ruby-forum.com/u/Arie_Kusuma_A)\
**Post date:** [September 5, 2006, 1:56am UTC](https://www.ruby-forum.com/t/net-http-post-form-got-200-but-no-insert-into-how-come-ho/67501/2 "2006-09-05T01:56:40Z")

</div>

On Sep 4, 2006, at 9:08 AM, Arie Kusuma A. wrote:

> Rendered blog2/\_form (0.00146)  
> Completed in 0.06593 (15 reqs/sec) | Rendering: 0.02027 (30%) | DB:  
> 0.01768 (26%) | 200 OK [[http://localhost/blog2/new](http://localhost/blog2/new)]
> 
> How come i’ve got 200 OK , but i didn’t get my INSERT Query run ???  
> How can i fix it?

This list is for Ruby questions, not Rails questions.

> ps.  
> Actually i’ve posted this to Rails maillist but nobody answered …  
> sigh

Please be persistent and/or patient!

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![Arie\_Kusuma\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d26b3c/32.png) [@Arie\_Kusuma\_A](https://www.ruby-forum.com/u/Arie_Kusuma_A)\
**Post date:** [September 5, 2006, 2:10am UTC](https://www.ruby-forum.com/t/net-http-post-form-got-200-but-no-insert-into-how-come-ho/67501/3 "2006-09-05T02:10:41Z")

</div>

On 9/4/06, Arie Kusuma A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,  
> I’m playing around with net/http and open-uri Ruby Libraries… I’m  
> trying to post to my own rails simple new action method.

Arie, you aren’t handling validation errors on @signature.save.

jeremy
