问题描述:

I recently upgraded my Rails web app from 3.0.3 to 3.0.10. And got the Wrong Number of arguments (1 for 0) error. I figured I would throw a "hail Mary" pass and hope that upgrading to Rails 3.2.8 would make things better. Not! :-)

I am stumped as to what could have caused this and I am a novice and not able to decipher the stack trace. Here is my stack trace. I'd appreciate some help.

I branched off of my master, so I can always start from scratch again, but I've tried twice so far with the same results.

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `display'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `send_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `process_action'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:403:in `_run__1653335973__process_action__374356064__callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cell/rendering.rb:7:in `render_state'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cell/caching.rb:83:in `render_state'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cell/rendering.rb:105:in `render_cell_state'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cell/rack.rb:27:in `render_cell_state'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cell/rendering.rb:100:in `render_cell_for'

vendor/ruby/1.8/gems/cells-3.8.6/lib/cells/rails.rb:53:in `render_cell'

app/views/home/index.html.erb:1:in `_app_views_home_index_html_erb__617638568_2260825620'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/template.rb:145:in `send'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/template.rb:145:in `render'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications.rb:125:in `instrument'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/template.rb:143:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/template_renderer.rb:47:in `render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/template_renderer.rb:46:in `render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/template_renderer.rb:45:in `render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/template_renderer.rb:18:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/renderer.rb:36:in `render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_view/renderer/renderer.rb:17:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:110:in `_render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/streaming.rb:225:in `_render_template'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:103:in `render_to_body'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/renderers.rb:28:in `render_to_body'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:88:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:16:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:40:in `render'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/core_ext/benchmark.rb:5:in `ms'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/core_ext/benchmark.rb:5:in `ms'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:40:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'

vendor/ruby/1.8/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:39:in `render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:10:in `default_render'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:5:in `send_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `process_action'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1183885179__process_action__918435846__callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `process_action'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'

vendor/ruby/1.8/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal.rb:203:in `dispatch'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_controller/metal.rb:246:in `action'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:36:in `call'

vendor/ruby/1.8/gems/journey-1.0.4/lib/journey/router.rb:68:in `call'

vendor/ruby/1.8/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'

vendor/ruby/1.8/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in `call'

vendor/ruby/1.8/gems/warden-1.2.1/lib/warden/manager.rb:35:in `call'

vendor/ruby/1.8/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'

vendor/ruby/1.8/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call'

vendor/ruby/1.8/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call'

vendor/ruby/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `call'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__1199251717__call__4__callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `send'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:65:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'

vendor/ruby/1.8/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'

vendor/ruby/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in `run'

vendor/ruby/1.8/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/commands/server.rb:70:in `start'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/commands.rb:55

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'

vendor/ruby/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50

script/rails:6:in `require'

script/rails:6

Here is the entire error message:

网友答案:

This issue is closed. Answer is that Cells controller methods need to have arguments passed to them.

In my cells controller I should have had a method such as:

def display(quote)
   @quote = Quote.first

  render
end

Instead what I had (and worked under ruby 1.8.7 and rails 3.0.3) was:

 def display
   @quote = Quote.first

  render
end 

My Bug Close! Special thank you to Nick Sutterer who patiently assisted me with this newbie bug!

相关阅读:
Top