Displaying 20 results from an estimated 120 matches similar to: "Net::HTTP.post_form got 200 but no INSERT INTO. How come? How to fix this?"
2006 Mar 19
1
Sending post request with post_form
Basically I have a controller with this:
@lang = params[''lang''] || ''en''
@errors = request.raw_post
@feed_stats =
Net::HTTP.post_form(URI.parse("http://www.google.com/tbproxy/spell?lang="
+ @lang), @errors)
render :text => @feed_stats
However whenever I run this I get an error message:
undefined method `post_form'' for Net::HTTP:Class
2009 Jun 05
1
Slow/unpredictive response of post_form from rails lib
Hi friends,
I''m facing a very strange problem...
I consume a webservice from within my rails app. I''ve written a thin
wrapper around the webservice using Net::HTTP.post_form
However, when calling the API from within my controllers, the API calls
randomly fail, complaining about timeout.
But - when I wrote a simple iterative test (500 iterations), calling the
same webservice
2007 Jun 10
0
pb when posting to an action "render_text body, :status => 400"
Hi,
I''m trying to do a little openid-server in rails.
I encounter a very strange problem for me, you can see all the story in the
openid mailing-list :
http://lists.openidenabled.com/pipermail/dev/2007-May/000666.html
http://lists.openidenabled.com/pipermail/dev/2007-June/000700.html
In short, the problem is :
the server has to do a "render_text body, :status => 400"
2007 Jun 12
1
alias_method_chain and Class methods (a Ruby question)
Hello list,
I am trying to override the post_form method of Net::HTTP so that it
does something before actually doing the post. I tried the following
in environments/development.rb
module Net
class HTTP
alias_method_chain :post_form, :intercept
def post_form_with_intercept(url, params)
# Do something before post
logger.info(''About to post at
2010 May 17
2
"end of file" error for "net/https"
Hi,
I have written following code:-
It is working fine for http protocol. But whenever I am doing for https
I getting an error "end of file reached".
Can anyone tell me what is wrong with the code?
def email_to_friend
require ''net/http''
require "net/https"
require ''uri''
#res =
2007 Jul 06
0
Removing One Element From a Serialized Form
Hi all,
I''m trying to serialize a form with the exception of one specific
element.
Serializing the form in a hash (without pulling out specific elements)
works:
<li>
<%= link_to_remote ''(Save)'', {:url => post_path(@post), :with => "$
(''post_form'').serialize(true)" }, :method => :put %>
</li>
The generated code
2009 Feb 18
4
expire_fragment with memcached
Hello all,
We know that memcached or memcached-client doesn''t support regex... But
It seems it doesn''t support expire_fragment either :/
I''m trying to use expire_fragment with memcached as following :
expire_fragment(:controller => ''home'', :action => :list_posts)
But apparently it''s not supported by memcached :
RuntimeError (Not
2006 May 21
0
expiring cache fragments using script/runner
I''ve just set up caching on my site and want to expire some of fragments on
an hourly basis.
I was going to use cron and script/runner to do this.
For other fragments that I am expiring, I am using expire_fragment inside a
sweeper class, something like:
class QuestionSweeper < ActionController::Caching::Sweeper
observe Question
def after_validation_on_update(question)
2006 Jan 16
0
expire_fragment problem
Hello,
I am trying to invalidate a cached fragment.
My fragment looks like
<% cache (
:controller=>''users'',:action=>''additem_to_cart'',:action_suffix=>@user.id) %>
At this point,rails has created 2 cache files correctly and everything works
fine becuase I dont see rails making calls to the SQL db to get items from
DB.Instead it uses cache.
Now
2010 Sep 01
4
NoMethodError: undefined method `force_encoding' for "Conten
Hi everyone!
Im trying to install mechanizer from
http://github.com/tenderlove/mechanize.
I`ve clone the project into /tmp folder. When I do rake inside the
folder /tmp/mechanizer it gives me this error:
mac159180:mechanize renatosis$ rake
(in /private/tmp/mechanize)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w
-Ilib:bin:test:. -e ''require "rubygems";
2012 Feb 16
3
Mechanize::ResponseCodeError: 500
> Excuse me if my issue is a little bit application-specific. I need
> Mechanize to submit bunch of data from our server to an online reservation
> system. The url is https://secure.mdausa.org/donate/
> It works in my browser however using mechanize following error appears:
>
> /Library/Ruby/Gems/1.8/gems/mechanize-2.0.1/lib/mechanize/http/agent.rb:241:in
> `fetch'':
2005 Nov 04
1
expire_fragment outside of a controller
I am trying to figure out a way to call the
expire_fragment outside of a controller. I need to
expire some fragments on a hourly basis. I have a
Thread that every hour that will perform a task. The
expire_fragment is located in the module
ActionController::Caching::Fragments as an instance
method.
Do I need to mixin the model
ActionController::Caching::Fragments into my class?
Or is there
2010 Jun 03
3
issue submitting a form
Hi. Recently I started rebuilding my old Mechanize script, which I
used to automatically log in to a certain site and retrieve files from
it. Old version worked great, however, when I did the update it
started complaining. Here''s the log of the error:
/Users/lukastolyarov/.gem/ruby/1.8/gems/mechanize-1.0.0/lib/mechanize/form/field.rb:30:in
`<=>'': undefined method
2007 Oct 21
4
Making 'expire_fragment' available to a model?
I noticed a lot of repetition across different Sweeper models in my
app expiring the same fragments and so have been trying to move all
the expire_fragment calls into another model which the sweepers can
then use but it''s not working as I''d hoped..
I''ve created a CacheDestroyer model and want to be able to call
something to the effect of:
2008 Jan 14
3
Reading HTTP Request parameters
Hello
I''ve a client which send this request to a mongrel HTTPHandler :
res=Net::HTTP.post_form(URI.parse(''http://localhost:3000/test''),{"a"=>1,"b"=>2})
But in the handler I can''t read the parameters one by one, I can read
the entire String only :
class Serveur
class MyHandler < Mongrel::HttpHandler
def process(req, resp)
2006 Nov 30
0
Query string based on the selection in HTTP POST
I want to generate the query string based on the options selected. For
example
it could be www.test.com/search?id=1 or
www.test.com/search?id=1&zip=60008. How could I achieve this using
http::POST?
I tried the following, which didn''t work
url = "{''id'' => 1, ''zip'' => 60008}"
res =
2010 Oct 31
1
Rails application Webservices
hi all,
I have a rails application at http://electric-sky-98.heroku.com/products
require ''net/http''
require ''uri''
res = Net::HTTP.get_response(URI.parse(''http://electric-
sky-98.heroku.com/products.xml''))
puts res.body
the above code gave me the xml file below:
<?xml version="1.0"
2006 Apr 29
0
Trouble with firefox and AJAX
I''ve been creating my own message board in rails as a learning
exercise. I''m currently trying to implement posting using AJAX, so the
topic page as a whole doesn''t need reloading.
What I''ve written works as epected in IE6 and Safari, but the AJAX
call fails silently in Firefox 1.5 -- although the server has logged
the request, the "success" callback
2006 Aug 07
0
Rails fragment caching bug?
<% cache(:part => @user.id) do%> in the file controller => users, action
=> show.
Regardless if you put the action so it ends up as <% cache(:action =>
''show'', :part => @user.id) do%> or the controller, the file will come
out in "tmp>cache>`SERVER`>users>show>1.part=userid#.cache . Which is
fine except for the 1 in the cache
2006 Feb 28
0
Rolled my own alternative to trigger function with OLD/NEW
Back with PostgreSQL, I just inspected OLD and NEW in trigger functions.
I came up with this alternative in Rails:
class Item < ActiveRecord::Base
def active=(value)
self.set_old(''active'', self.active)
write_attribute(:active, value)
end
def after_update
if !get_old(''active'') and self.active
Notifier::deliver_item_approved(self)