Get value back from popup

There is a javascript property called "opener" that refers to the
parent window object that opened the child window. That way you can
call opener.document.blahblahblah to access forms, or whatever else you
need to do. Just google "javascript opener"

I'm using Rails 1.1.6, and I getting some strange error messages when using error_messages_for.

Whenever the validation is triggered (by leaving a field blank, for instance), I get this ArgumentError:

   wrong number of arguments (2 for 1)

The call to error_messages_for looks like this:

   1: <%= error_messages_for :link %>
   2:
   3: <!--[form:link]-->
   4: <p><label for="link_name">Name</label><br/>

The application trace is blank, but the framework trace leads to a call to pluralize:

  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/active_record_helper.rb:110:in `pluralize'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/active_record_helper.rb:110:in `error_messages_for'
  #{RAILS_ROOT}/vendor/plugins/links/app/views/admin/links/_form.rhtml:1:in `_run_rhtml__Users_michael_Sites_gingerjargourds46boundingline46com_vendor_plugins_links_app_views_admin_links__form'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:266:in `render'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:59:in `render_partial'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:33:in `benchmark'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:58:in `render_partial'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:278:in `render'
  #{RAILS_ROOT}/vendor/plugins/links/app/views/admin/links/new.rhtml:2:in `_run_rhtml__Users_michael_Sites_gingerjargourds46boundingline46com_vendor_plugins_links_app_views_admin_links_new'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:in `render_file'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:648:in `render_with_no_layout'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:769:in `render_without_layout'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:718:in `render_action'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:670:in `render_with_no_layout'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:242:in `render_without_benchmark'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render'
  /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render'
  #{RAILS_ROOT}/vendor/plugins/links/app/controllers/admin/links_controller.rb:42:in `create'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
  /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
  /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process'
  /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'
  /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:in `process_request'
  /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in `process!'
  /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
  /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
  /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in `process!'
  /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in `process!'
  /Users/michael/Sites/gingerjargourds.boundingline.com/public/dispatch.fcgi:24

Some controllers have this problem, others don't, and I can't figure out what's different about them.

There was a similar question raised in April:

   http://article.gmane.org/gmane.comp.lang.ruby.rails/62380/

But it doesn't look like anyone figured this out.

Any ideas?

Thanks,

Michael Powers
mpowers1@mac.com

Problem solved. Since at least one other person had the same problem in the past, I'll document it for the message archive.

Problem: I wanted to use singularize in a view, so I put

   include Inflector

in the helper file. Side effect: redefining the TextHelper version of pluralize() to be the Inflector (1 argument) version. But error_messages_for needs the TextHelper (2 argument) version. Doh!

Removed the include, called singularize() as Inflector.singularize(), and all is well.