ArgumentError“实习空字符串”Rails

时间:2011-02-28 15:20:30

标签: ruby-on-rails ruby string

突然开始在我正在进行的项目中为特定控制器的所有操作获取“实习空字符串”。这工作正常,然后我开始改变一些位,它破了,我现在似乎无法解决它。我已经将所有代码回滚到我之前进行任何更改的github版本,但似乎没有解决问题。

非常感谢任何帮助。

错误:

ArgumentError in Equipment itemsController#index

interning empty string

RAILS_ROOT: /Users/peterroome/Sites/Enso-Intranet
Application Trace | Framework Trace | Full Trace

/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:226:in `to_sym'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:226:in `valid_locale?'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:243:in `parse_extensions'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:233:in `split'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:118:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:81:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:38:in `new'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:38:in `register_template_from_file'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:29:in `[]'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:48:in `find_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:47:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:47:in `find_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1389:in `default_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/layout.rb:265:in `candidate_for_layout?'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/layout.rb:245:in `pick_layout'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:915:in `render_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:135:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:135:in `custom'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:179:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:179:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:173:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:173:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:107:in `respond_to'
/Users/peterroome/Sites/Enso-Intranet/app/controllers/equipment_items_controller.rb:14:in `index'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1331:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:617:in `call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/flash.rb:151:in `perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:606:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:391:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:386:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/routing/route_set.rb:438:in `call'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:87:in `dispatch'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:121:in `_call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/rack_static_bug_avoider.rb:10:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/redirect_interceptor.rb:11:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panels/timer_panel.rb:15:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panels/timer_panel.rb:14:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/toolbar.rb:17:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug.rb:42:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:114:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:108:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
script/server:3

/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:226:in `to_sym'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:226:in `valid_locale?'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:243:in `parse_extensions'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:233:in `split'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/template.rb:118:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:81:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:38:in `new'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:38:in `register_template_from_file'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/reloadable_template.rb:29:in `[]'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:48:in `find_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:47:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_view/paths.rb:47:in `find_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1389:in `default_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/layout.rb:265:in `candidate_for_layout?'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/layout.rb:245:in `pick_layout'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:915:in `render_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:135:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:135:in `custom'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:179:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:179:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:173:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:173:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/mime_responds.rb:107:in `respond_to'
/Users/peterroome/Sites/Enso-Intranet/app/controllers/equipment_items_controller.rb:14:in `index'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1331:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:617:in `call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.9/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/flash.rb:151:in `perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/filters.rb:606:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:391:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/base.rb:386:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/routing/route_set.rb:438:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:87:in `dispatch'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:121:in `_call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:29:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:29:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:9:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:28:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/static.rb:33:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/rack_static_bug_avoider.rb:10:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/redirect_interceptor.rb:11:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:23:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:22:in `each'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:22:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:23:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:22:in `each'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/cascade.rb:22:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panels/timer_panel.rb:15:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panels/timer_panel.rb:14:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/panel.rb:23:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:77:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug/toolbar.rb:17:in `call'
/Users/peterroome/Sites/Enso-Intranet/vendor/plugins/rack-bug/lib/rack/bug.rb:42:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/string_coercion.rb:25:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/params_parser.rb:15:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/session/cookie_store.rb:100:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/failsafe.rb:26:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:114:in `call'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/reloader.rb:34:in `run'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:108:in `call'
/Library/Ruby/Gems/1.8/gems/rails-2.3.9/lib/rails/rack/static.rb:31:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'
/Library/Ruby/Gems/1.8/gems/rails-2.3.9/lib/rails/rack/log_tailer.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in `process'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in `run'
/Library/Ruby/Gems/1.8/gems/rails-2.3.9/lib/commands/server.rb:111
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
script/server:3


Request

Parameters:

{"type"=>"Tank"}

Show session dump

--- 

Response

Headers:

{"Content-Type"=>"text/html",
 "Cache-Control"=>"no-cache"}

控制器:

class EquipmentItemsController < ApplicationController

  # Before filters
  #
  before_filter :body_id, :load_user, :equipment_types

  def index
    if params[:type]
      equipment_items = EquipmentItem.by_type(params[:type])
    else
      equipment_items = EquipmentItem.find(:all)
    end
    @equipment_items = equipment_items.paginate(:page => params[:page])
    @equipment_items_count = equipment_items.count

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @equipment_items }
    end
  end

  def show
    @equipment_item = EquipmentItem.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @equipment_item }
    end
  end

  def new
    @equipment_item = EquipmentItem.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @equipment_item }
    end
  end

  def edit
    @equipment_item = EquipmentItem.find(params[:id])
  end

  def create
    @equipment_item = EquipmentItem.new(params[:equipment_item])

    respond_to do |format|
      if @equipment_item.save
        format.html { redirect_to(@equipment_item, :notice => 'EquipmentItem was successfully created.') }
        format.xml  { render :xml => @equipment_item, :status => :created, :location => @equipment_item }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @equipment_item.errors, :status => :unprocessable_entity }
      end
    end
  end

  def update
    @equipment_item = EquipmentItem.find(params[:id])

    respond_to do |format|
      if @equipment_item.update_attributes(params[:equipment_item])
        format.html { redirect_to(@equipment_item, :notice => 'EquipmentItem was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @equipment_item.errors, :status => :unprocessable_entity }
      end
    end
  end

  def destroy
    @equipment_item = EquipmentItem.find(params[:id])
    @equipment_item.destroy

    respond_to do |format|
      format.html { redirect_to(equipment_items_url) }
      format.xml  { head :ok }
    end
  end

  protected
  def body_id
    @body_id = "body_equipment"
  end

  def load_user
    @current_user = current_user
  end

  def equipment_types
    @equipment_types = SitePreferences::EQUIPMENT_TYPES.collect{ |type| type }
  end
end

型号:

class EquipmentItem < ActiveRecord::Base

  # Pagination setup
  cattr_reader :per_page
  @@per_page = 20

  # Validation
  validates_uniqueness_of :name
  validates_presence_of :name, :type

  # Named scopes
  named_scope :by_type,
              lambda { |type| {
                :conditions => ["equipment_type = ?", type],
                :order => "name ASC"
              }}

  # Instance methods
  def to_s
    name
  end
end

查看(不太重要,我认为因为代码没有像渲染页面那样):

<h1>Hello World</h1>

我已经玩了几个小时了,这个错误似乎在response_to代码之后和动作'end'之前呈现的动作结束时正确。

2 个答案:

答案 0 :(得分:4)

你的模板目录中有什么?您的某个模板似乎有一个空的区域设置,导致模板引擎发生故障。

答案 1 :(得分:2)

我认为在Ruby 1.9上允许实习空字符串,但在Ruby 1.8上则不允许。虽然这对您来说似乎不是问题,但这可以解释为什么错误似乎突然发生。