Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error When Filtering Legacy Enum Fields #3651

Closed
deepakisrani opened this issue Oct 9, 2023 · 2 comments
Closed

Error When Filtering Legacy Enum Fields #3651

deepakisrani opened this issue Oct 9, 2023 · 2 comments

Comments

@deepakisrani
Copy link

Description
When applying the filters on the fields populated using the legacy enum, rails_admin breaks throwing the undefined method [] for nil:NilClass while rendering the content on the page.

We use rails_admin in a large Rails project and started facing this issue after upgrading rails_admin from 2 to 3 and the Rails version from 6 to 7. I have created a dummy application replicating the setup we have with all the configuration, first we had assumed that the problem lies within the configuration of our company's code but the issue replicated itself within the new application as well, link to the repo, this was a fresh install of Rails 7.1 along with rails_admin.

Reproduction Steps
Apply a filter on any of the fields utilizing the legacy enum.

Expected Behavior
Expect the page to render properly with either the resulting set or no records found.

Additional context

  • rails version: 7.1
  • ruby version: 2.7.6
  • rails_admin version: 3.1.2
  • rails_admin npm package version: NA (Using sprockets)
  • Github Link to dummy application: https://github.com/deepakisrani/test_app
  • full stack trace
[rails_admin (3.1.2) lib/rails_admin/config/fields/types/enum.rb:31:in `block in <class:Enum>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/configurable.rb:77:in `instance_eval'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/configurable.rb:77:in `block in register_instance_option'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/fields/types/enum.rb:14:in `block in <class:Enum>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/configurable.rb:77:in `instance_eval'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/configurable.rb:77:in `block in register_instance_option'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/fields/base.rb:106:in `filter_options'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/helpers/rails_admin/main_helper.rb:52:in `block in ordered_filter_options'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/helpers/rails_admin/main_helper.rb:44:in `map'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/helpers/rails_admin/main_helper.rb:44:in `ordered_filter_options'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/views/rails_admin/main/index.html.erb:57](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/buffers.rb:75:in `capture'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/helpers/capture_helper.rb:50:in `capture'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/helpers/form_tag_helper.rb:81:in `form_tag'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/views/rails_admin/main/index.html.erb:55](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/base.rb:264:in `public_send'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/base.rb:264:in `_run'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/template.rb:254:in `block in render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:208:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/template.rb:535:in `instrument_render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/template.rb:248:in `render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:66:in `block (2 levels) in render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `block in instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications/instrumenter.rb:58:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:60:in `block in render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:76:in `block in render_with_layout'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `block in instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications/instrumenter.rb:58:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:75:in `render_with_layout'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:59:in `render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/template_renderer.rb:11:in `render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/renderer.rb:63:in `render_template_to_object'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/renderer/renderer.rb:31:in `render_to_object'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/rendering.rb:135:in `block in _render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/base.rb:291:in `in_rendering_context'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/rendering.rb:134:in `_render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/streaming.rb:256:in `_render_template'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/rendering.rb:121:in `render_to_body'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/rendering.rb:158:in `render_to_body'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/renderers.rb:141:in `render_to_body'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/rendering.rb:27:in `render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/rendering.rb:139:in `render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:29:in `block (2 levels) in render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/core_ext/benchmark.rb:14:in `ms'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:29:in `block in render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:98:in `cleanup_view_runtime'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activerecord (7.1.0) lib/active_record/railties/controller_runtime.rb:39:in `cleanup_view_runtime'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:28:in `render'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/actions/index.rb:47:in `block (4 levels) in <class:Index>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) lib/rails_admin/config/actions/index.rb:45:in `block (2 levels) in <class:Index>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/controllers/rails_admin/main_controller.rb:38:in `instance_eval'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rails_admin (3.1.2) app/controllers/rails_admin/main_controller.rb:38:in `action_missing'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/base.rb:238:in `_handle_action_missing'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/base.rb:224:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/rendering.rb:165:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/callbacks.rb:259:in `block in process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/callbacks.rb:121:in `block in run_callbacks'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actiontext (7.1.0) lib/action_text/rendering.rb:23:in `with_renderer'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actiontext (7.1.0) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/callbacks.rb:130:in `instance_exec'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/callbacks.rb:130:in `block in run_callbacks'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/callbacks.rb:141:in `run_callbacks'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/callbacks.rb:258:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/rescue.rb:25:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `block in instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications/instrumenter.rb:58:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/notifications.rb:206:in `instrument'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/instrumentation.rb:73:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal/params_wrapper.rb:261:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activerecord (7.1.0) lib/active_record/railties/controller_runtime.rb:32:in `process_action'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/abstract_controller/base.rb:160:in `process'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionview (7.1.0) lib/action_view/rendering.rb:40:in `process'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal.rb:227:in `dispatch'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_controller/metal.rb:309:in `dispatch'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/route_set.rb:32:in `serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:51:in `block in serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:124:in `each'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:124:in `find_routes'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:32:in `serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/route_set.rb:882:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/engine.rb:529:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/railtie.rb:226:in `public_send'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/railtie.rb:226:in `method_missing'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/mapper.rb:22:in `block in <class:Constraints>'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/mapper.rb:51:in `serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:51:in `block in serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:124:in `each'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:124:in `find_routes'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/journey/router.rb:32:in `serve'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/routing/route_set.rb:882:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/tempfile_reaper.rb:20:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/etag.rb:29:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/conditional_get.rb:31:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/head.rb:15:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/http/permissions_policy.rb:36:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/http/content_security_policy.rb:33:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/cookies.rb:689:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activerecord (7.1.0) lib/active_record/migration.rb:653:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/callbacks.rb:101:in `run_callbacks'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/callbacks.rb:28:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/executor.rb:14:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/actionable_exceptions.rb:16:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[web-console (4.2.1) lib/web_console/middleware.rb:132:in `call_app'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[web-console (4.2.1) lib/web_console/middleware.rb:19:in `block in call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[web-console (4.2.1) lib/web_console/middleware.rb:17:in `catch'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[web-console (4.2.1) lib/web_console/middleware.rb:17:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/rack/logger.rb:37:in `call_app'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/rack/logger.rb:24:in `block in call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/tagged_logging.rb:135:in `block in tagged'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/tagged_logging.rb:39:in `tagged'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/tagged_logging.rb:135:in `tagged'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/broadcast_logger.rb:212:in `method_missing'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/rack/logger.rb:24:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/remote_ip.rb:92:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/request_id.rb:28:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/method_override.rb:28:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/runtime.rb:24:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[activesupport (7.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/server_timing.rb:59:in `block in call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/server_timing.rb:24:in `collect_events'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/server_timing.rb:58:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/executor.rb:14:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/static.rb:25:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[rack (3.0.8) lib/rack/sendfile.rb:114:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[actionpack (7.1.0) lib/action_dispatch/middleware/host_authorization.rb:141:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[railties (7.1.0) lib/rails/engine.rb:529:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/configuration.rb:272:in `call'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/request.rb:100:in `block in handle_request'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/thread_pool.rb:378:in `with_force_shutdown'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/request.rb:99:in `handle_request'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/server.rb:443:in `process_client'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/server.rb:241:in `block in run'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
[puma (6.4.0) lib/puma/thread_pool.rb:155:in `block in spawn_thread'](http://localhost:3000/admin/enum_test?f%5Bsingle_value%5D%5B62405%5D%5Bv%5D=Key+2&query=#)
@deepakisrani
Copy link
Author

The fix in #3647 solved my issue.

robotfelix added a commit to robotfelix/rails_admin that referenced this issue Jun 7, 2024
A lack of tests for these code paths led to a regression for legacy enums in Rails Admin 3.0 (railsadminteam#3651).

This tests the code path using `abstract_model` that was fixed by @fuegas in the previous commit.
@mshibuya
Copy link
Member

mshibuya commented Jun 8, 2024

OK I could figure it out. The implementation in be9a75e has the issue of calling #filter_options without setting bindings, resulting in the nil error.
I've made a fix as d62f604, so please give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants