This project is archived and is in readonly mode.

#3267 ✓duplicate
John Woods

Problem with String Interpolation breaks WWW::Mechanize

Reported by John Woods | September 26th, 2009 @ 09:39 PM

I will call this a Rails bug rather than a Mechanize bug because, I assume, code that runs in IRB should also run in the Rails console. The code is as follows:

require 'rubygems' 
require 'mechanize' 
require 'logger' 
require 'uri' 
require 'net/http' 
agent = WWW::Mechanize.new { |a| a.log = Logger.new("mech.log") } 
agent.user_agent_alias = 'Mac Safari' 
page = agent.get('http://www.fyi.legis.state.tx.us/Address.aspx') 
search_form = page.form_with(:name => "AddressForm") 
search_form.field_with(:name => "Address1").value = "501 W 26th St, 
Apt 110" 
search_form.field_with(:name => "City").value = "Austin" 
search_form.field_with(:name => "ZipCode").value = "78705" 
search_form.field_with(:name => "DistrictType").options[0].select 
res = agent.submit(search_form, search_form.buttons.first)

And here are the error messages:

ArgumentError: one hash required
from /home/jwoods/NetBeansProjects/activista/vendor/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/core_ext/string/interpolation.rb:85:in '%' 
from /usr/lib/ruby/1.8/webrick/httputils.rb:352:in 'escape' 
from /usr/lib/ruby/1.8/webrick/httputils.rb:352:in 'gsub' 
from /usr/lib/ruby/1.8/webrick/httputils.rb:352:in 'escape' 
from /usr/lib/ruby/1.8/webrick/httputils.rb:370:in 'escape_form' 
from /usr/lib/ruby/1.8/www/mechanize/util.rb:9:in 'build_query_string' 
from /usr/lib/ruby/1.8/www/mechanize/util.rb:6:in 'map' 
from /usr/lib/ruby/1.8/www/mechanize/util.rb:6:in 'build_query_string' 
from /usr/lib/ruby/1.8/www/mechanize/form.rb:199:in 'request_data' 
from /usr/lib/ruby/1.8/www/mechanize.rb:387:in 'post_form' 
from /usr/lib/ruby/1.8/www/mechanize.rb:331:in 'submit' 
from (irb):23

I am using edge rails and Mechanize from about four days ago. I had also tried with an earlier version of Rails.
Here's the revision stamp in my vendor/rails dir. I'm a noob, so apologies if I'm missing information. I'll be happy to find whatever you all need.
REVISION_3600c3840e8d0c612c974e6af5ce010535492fbe

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages