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://localhos
t: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
]
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.
--
Name : Arie Kusuma Atmaja, A.K.A Arie, A.K.A ariekeren /
YM! = riyari3
http://ariekusu
maatmaja.wordpress.com
Let's build Ruby Indonesia stronger
http://groups.
yahoo.com/groups/id-ruby
Go go go Ruby go!
Mp3Info.open("Linkin Park - Abyss.mp3") { |f|
puts f }
_______________________________________________
Rails mailing list
Rails lists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
|