Filterrific:错误:未定义的方法`空?'为零:NilClass

时间:2014-12-12 00:15:59

标签: ruby-on-rails forms ruby-on-rails-4

无法使filterrific gem工作。我收到错误"错误:未定义的方法`空?'对于nil:NilClass",似乎问题来自我表格中的f.select。

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

我一直试图让这个宝石一整天都没有运气。很棒的文档,但只是不能让它工作。非常感谢任何指针。

[STACK TRACE]

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>'

1 个答案:

答案 0 :(得分:1)

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

似乎错误是由于演示应用程序中的错误,这已得到修复并被提交到演示应用程序。请在下面的链接中找到答案(它与上面提到的链接相同)

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