form_tag issues after Rails upgrade to 2.0.2

Any idea why this form_tag is broken after moving from Rails 1.2.6 -> 2.0.2?

<% form_tag :controller => 'login', :action => 'login' do -%>

I get the error:

wrong number of arguments (1 for 2)

I have tried several other incantations, but none work, same error:

<% form_tag( :controller => 'login', :action => 'login' ) do -%>

<% form_tag( { :controller => 'login', :action => 'login' } ) do -%>

And what's even more strange is there's another form_tag call above
this one that _isn't_ throwing an error.

<% form_tag :controller => 'login', :action => 'logout' do -%>

Would it have anything to do with the :controller and :action being different? That’s the only difference I see in them.

The problem is with reverse_proxy_fix. Anything that uses url_for is
b0rken, even the latest version from svn.

Are you positive? I’m the maintainer of that. When you install it, make sure you install the correct version for your version of Rails.


http://www.napcsweb.com/blog/2007/12/18/reverse_proxy_fix-1041-released-with-rails-20-support/

Are you positive? I'm the maintainer of that. When you install it, make sure
you install the correct version for your version of Rails.

From my blog:

http://www.napcsweb.com/blog/2007/12/18/reverse_proxy_fix-1041-released-with-rails-20-support/

Yes. The version from subversion doesn't work. Anything that uses
url_for doesn't work, form_tag and link_to specifically.

And then following the instruction here:

http://www.napcsweb.com/blog/2007/12/18/reverse_proxy_fix-1041-released-with-rails-20-support/

This version dies before completing the install:

script/plugin install http://svn.napcsweb.com/public/reverse_proxy_fix

+ ./README
+ ./Rakefile
+ ./init.rb
+ ./install.rb
+ ./lib/116.rb
+ ./lib/123.rb
+ ./lib/20.rb
+ ./lib/config.rb
+ ./tasks/reverse_proxy_fix_tasks.rake
Unknown command: http://svn.napcsweb.com/public/reverse_proxy_fix

Here's my setup if that helps:

ruby -v

ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-linux]

gem li

*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activerecord-oracle-adapter (1.0.0)
activeresource (2.0.2)
activesupport (2.0.2)
calendar_grid (1.0.3)
capistrano (2.1.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.9)
fastthread (1.0.1)
fcgi (0.8.7)
gem_plugin (0.2.3)
highline (1.4.0)
mongrel (1.1.3)
mysql (2.7)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
postgres (0.7.9.2008.01.03)
rails (2.0.2)
rake (0.8.1)
ruby-debug-base (0.10.0)
ruby-net-ldap (0.0.4)
rubygems-update (1.0.1)
sources (0.0.1)
sqlite3-ruby (1.2.1)
termios (0.9.4)
wirble (0.1.2)

> script/plugin install http://svn.napcsweb.com/public/reverse_proxy_fix
+ ./README
+ ./Rakefile
+ ./init.rb
+ ./install.rb
+ ./lib/116.rb
+ ./lib/123.rb
+ ./lib/20.rb
+ ./lib/config.rb
+ ./tasks/reverse_proxy_fix_tasks.rake
Unknown command: http://svn.napcsweb.com/public/reverse_proxy_fix

The FileUtils require seems to be the problem. If I modify install.rb
like this:

#require 'FileUtils'
require '/usr/local/lib/ruby/1.8/fileutils.rb'

It then runs the install.

Meanwhile my PATH and ruby $LOAD_PATH seems perfectly fine otherwise:

which ruby

/usr/local/bin/ruby

irb

FileUtils.class

=> Module

$LOAD_PATH

=> ["/usr/local/lib/ruby/gems/1.8/gems/wirble-0.1.2/bin",
"/usr/local/lib/ruby/gems/1.8/gems/wirble-0.1.2/.",
"/usr/local/lib/ruby/site_ruby/1.8",
"/usr/local/lib/ruby/site_ruby/1.8/i686-linux",
"/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/1.8",
"/usr/local/lib/ruby/1.8/i686-linux", "."]

Maybe script/plugin has some issue? *shrug*

Well, this is meant for Windows users, but I did test this on the macbook pro here without incident. I’ll look into this more.

When you say “the version from subversion doesn’t work” where are you looking?

http://svn.napcsweb.com/public/reverse_proxy_fix is the path to the latest version.

In rails 2.0, url_for was changed to accept one paramenter. That’s why the plugin contains multiple versions of reverse_proxy_fix.rb If you have problems, simply do it by hand:

rename 20.rb to reverse_proxy_fix.rb in the plugin’s lib folder. Then just set the base path yourself in the config.rb file in the plugin’s lib folder.

Well, this is meant for Windows users, but I did test this on the macbook
pro here without incident. I'll look into this more.

When you say "the version from subversion doesn't work" where are you
looking?

http://svn.napcsweb.com/public/reverse_proxy_fix is the
path to the latest version.

That's the place. I found that repo in someone's blog before I found
your actual plugin install instructions.

In rails 2.0, url_for was changed to accept one paramenter. That's why the
plugin contains multiple versions of reverse_proxy_fix.rb If you have
problems, simply do it by hand:

rename 20.rb to reverse_proxy_fix.rb in the plugin's lib folder. Then just
set the base path yourself in the config.rb file in the plugin's lib folder.

Yeah, I got it working after tinkering a bit with the install.rb.

Thanks for the responses. Let me know if there's anything I can
provide to help debug. It's just weird how that require bombs for no
apparent reason.