繁体   English   中英

明显:错误:未定义方法“空?” 对于nil:NilClass

[英]Filterrific: ERROR: undefined method `empty?' for nil:NilClass

无法获得过滤效果良好的宝石。 我收到错误消息“错误:未定义的方法'空吗?' for nil:NilClass“,问题似乎出在我表格中的f.select。

我在此链接中附加了相关代码: https : //github.com/jhund/filterrific/issues/26

我一直在努力让这颗宝石整天没有运气。 好的文档,但是却无法正常工作。 将不胜感激任何指针。

[堆栈跟踪]

NoMethodError - undefined method `empty?' for nil:NilClass:
  actionview (4.1.4) lib/action_view/helpers/tags/select.rb:36:in `grouped_choices?'
  actionview (4.1.4) lib/action_view/helpers/tags/select.rb:20:in `render'
  actionview (4.1.4) lib/action_view/helpers/form_options_helper.rb:165:in `select'
  actionview (4.1.4) lib/action_view/helpers/form_options_helper.rb:779:in `select'
   () Users/erikchan/Workspace/productchamp/app/views/projects/_admin_angels.html.erb:9:in `block in _app_views_projects__admin_angels_html_erb___4541097495823350739_70281797177960'
  actionview (4.1.4) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
  actionview (4.1.4) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
  actionview (4.1.4) lib/action_view/helpers/capture_helper.rb:38:in `capture'
  actionview (4.1.4) lib/action_view/helpers/form_helper.rb:434:in `form_for'
  filterrific (1.4.2) lib/filterrific/action_view_extension.rb:18:in `form_for'
   () Users/erikchan/Workspace/productchamp/app/views/projects/_admin_angels.html.erb:6:in `_app_views_projects__admin_angels_html_erb___4541097495823350739_70281797177960'
  actionview (4.1.4) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.4) lib/action_view/template.rb:339:in `instrument'
  actionview (4.1.4) lib/action_view/template.rb:143:in `render'
  actionview (4.1.4) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
  actionview (4.1.4) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
  actionview (4.1.4) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.4) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  actionview (4.1.4) lib/action_view/renderer/partial_renderer.rb:278:in `render'
  actionview (4.1.4) lib/action_view/renderer/renderer.rb:47:in `render_partial'
  actionview (4.1.4) lib/action_view/helpers/rendering_helper.rb:35:in `render'
   () Users/erikchan/Workspace/productchamp/app/views/projects/show_dashboard.html.erb:34:in `_app_views_projects_show_dashboard_html_erb___2410799250841293991_70281799504140'
  actionview (4.1.4) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.4) lib/action_view/template.rb:339:in `instrument'
  actionview (4.1.4) lib/action_view/template.rb:143:in `render'
  actionview (4.1.4) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
  actionview (4.1.4) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `instrument'
  actionview (4.1.4) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  actionview (4.1.4) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
  actionview (4.1.4) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
  actionview (4.1.4) lib/action_view/renderer/template_renderer.rb:53:in `render_template'
  actionview (4.1.4) lib/action_view/renderer/template_renderer.rb:17:in `render'
  actionview (4.1.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
  actionview (4.1.4) lib/action_view/renderer/renderer.rb:23:in `render'
  actionview (4.1.4) lib/action_view/rendering.rb:99:in `_render_template'
  actionpack (4.1.4) lib/action_controller/metal/streaming.rb:217:in `_render_template'
  actionview (4.1.4) lib/action_view/rendering.rb:82:in `render_to_body'
  actionpack (4.1.4) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
  actionpack (4.1.4) lib/action_controller/metal/renderers.rb:32:in `render_to_body'
  actionpack (4.1.4) lib/abstract_controller/rendering.rb:25:in `render'
  actionpack (4.1.4) lib/action_controller/metal/rendering.rb:16:in `render'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
  activesupport (4.1.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
   () Users/erikchan/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
  activesupport (4.1.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
  activerecord (4.1.4) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:40:in `render'
  remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
  actionpack (4.1.4) lib/action_controller/metal/mime_responds.rb:258:in `respond_to'
   () Users/erikchan/Workspace/productchamp/app/controllers/projects_controller.rb:118:in `show_dashboard'
  actionpack (4.1.4) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.1.4) lib/abstract_controller/base.rb:189:in `process_action'
  actionpack (4.1.4) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.1.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (4.1.4) lib/active_support/callbacks.rb:113:in `call'
  activesupport (4.1.4) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:229:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:229:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:166:in `block in halting'
  activesupport (4.1.4) lib/active_support/callbacks.rb:86:in `run_callbacks'
  actionpack (4.1.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.1.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.1.4) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.1.4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
  activerecord (4.1.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.1.4) lib/abstract_controller/base.rb:136:in `process'
  actionview (4.1.4) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.1.4) lib/action_controller/metal.rb:196:in `dispatch'
  actionpack (4.1.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.1.4) lib/action_controller/metal.rb:232:in `block in action'
  actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
  actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:50:in `call'
  actionpack (4.1.4) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.1.4) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:678:in `call'
  omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
  omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
  omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
  omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
  omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
  omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
  newrelic_rpm (3.7.3.204) lib/new_relic/rack/error_collector.rb:55:in `call'
  newrelic_rpm (3.7.3.204) lib/new_relic/rack/agent_hooks.rb:32:in `call'
  newrelic_rpm (3.7.3.204) lib/new_relic/rack/browser_monitoring.rb:27:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/flash.rb:254:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.1.4) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.1.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
  activerecord (4.1.4) lib/active_record/migration.rb:380:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.1.4) lib/active_support/callbacks.rb:82:in `run_callbacks'
  actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  better_errors (2.0.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (2.0.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (2.0.0) lib/better_errors/middleware.rb:57:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.4) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.4) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.4) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.0.3) lib/quiet_assets.rb:23:in `call_with_quiet_assets'
  actionpack (4.1.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/static.rb:64:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.4) lib/rails/engine.rb:514:in `call'
  railties (4.1.4) lib/rails/application.rb:144:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  unicorn (4.8.3) lib/unicorn/http_server.rb:576:in `process_client'
  unicorn (4.8.3) lib/unicorn/http_server.rb:670:in `worker_loop'
  newrelic_rpm (3.7.3.204) lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in `block (4 levels) in <top (required)>'
  unicorn (4.8.3) lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
  unicorn (4.8.3) lib/unicorn/http_server.rb:140:in `start'
  unicorn-rails (2.2.0) lib/unicorn_rails.rb:33:in `run'
  rack (1.5.2) lib/rack/server.rb:264:in `start'
  railties (4.1.4) lib/rails/commands/server.rb:69:in `start'
  railties (4.1.4) lib/rails/commands/commands_tasks.rb:81:in `block in server'
  railties (4.1.4) lib/rails/commands/commands_tasks.rb:76:in `server'
  railties (4.1.4) lib/rails/commands/commands_tasks.rb:40:in `run_command!'
  railties (4.1.4) lib/rails/commands.rb:17:in `<top (required)>'
   () Users/erikchan/Workspace/productchamp/bin/rails:8:in `<top (required)>'
  spring (1.1.3) lib/spring/client/rails.rb:27:in `call'
  spring (1.1.3) lib/spring/client/command.rb:7:in `call'
  spring (1.1.3) lib/spring/client.rb:26:in `run'
  spring (1.1.3) bin/spring:48:in `<top (required)>'
  spring (1.1.3) lib/spring/binstub.rb:11:in `<top (required)>'
   () Users/erikchan/Workspace/productchamp/bin/spring:16:in `<top (required)>'
   () rails:3:in `<main>'

我知道已经有很长时间了,但是如果有人仍然想知道答案,请在下面找到它:

似乎该错误是由于演示应用程序中的错误引起的,此问题已修复,并已提交给演示应用程序。 请在以下链接中找到答案(与上述链接相同)

https://github.com/jhund/filterrific/issues/26

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM