I am creating a new Rails app, i created an admin page for Users with active_admin gem, when trying to access the page I keep getting this error
ActionView::Template::Error (undefined method `email_equals' for an instance of Ransack::Search):
1: # frozen_string_literal: true
2: insert_tag renderer_for(:index)
ransack (4.1.1) lib/ransack/search.rb:114:in `method_missing'
here is my admin page for User
ActiveAdmin.register User do
index do
id_column
column :current_sign_in_at
column :sign_in_count
column :created_at
end
end
this came after I previously fixed a error ref: Ransack needs <Model> Associations explicitly allowlisted as searchable
here is the full log:
ActionView::Template::Error (undefined method `email_equals' for an instance of Ransack::Search):
1: # frozen_string_literal: true
2: insert_tag renderer_for(:index)
ransack (4.1.1) lib/ransack/search.rb:114:in `method_missing'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:62:in `public_send'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:62:in `block in current_filter'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:62:in `each'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:62:in `detect'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:62:in `current_filter'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:52:in `select_html'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:42:in `block in to_html'
actionview (7.1.2) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'
actionview (7.1.2) lib/action_view/buffers.rb:75:in `capture'
actionview (7.1.2) lib/action_view/helpers/capture_helper.rb:50:in `capture'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base.rb:13:in `input_wrapping'
activeadmin (3.2.0) lib/active_admin/inputs/filters/base/search_method_select.rb:40:in `to_html'
activeadmin (3.2.0) lib/active_admin/inputs/filters/string_input.rb:20:in `to_html'
formtastic (5.0.0) lib/formtastic/helpers/input_helper.rb:240:in `input'
activeadmin (3.2.0) lib/active_admin/filters/forms.rb:15:in `filter'
activeadmin (3.2.0) lib/active_admin/filters/forms.rb:65:in `block (2 levels) in active_admin_filters_form_for'
activeadmin (3.2.0) lib/active_admin/filters/forms.rb:58:in `each'
activeadmin (3.2.0) lib/active_admin/filters/forms.rb:58:in `block in active_admin_filters_form_for'
actionview (7.1.2) lib/action_view/helpers/capture_helper.rb:50:in `block in capture'
actionview (7.1.2) lib/action_view/buffers.rb:75:in `capture'
actionview (7.1.2) lib/action_view/helpers/capture_helper.rb:50:in `capture'
actionview (7.1.2) lib/action_view/helpers/form_helper.rb:773:in `form_with'
actionview (7.1.2) lib/action_view/helpers/form_helper.rb:461:in `form_for'
activeadmin (3.2.0) lib/active_admin/filters/forms.rb:57:in `active_admin_filters_form_for'
arbre (1.7.0) lib/arbre/element.rb:183:in `method_missing'
activeadmin (3.2.0) lib/active_admin/filters/resource_extension.rb:169:in `block in filters_sidebar_section'
activeadmin (3.2.0) lib/active_admin/views/components/sidebar_section.rb:26:in `instance_exec'
activeadmin (3.2.0) lib/active_admin/views/components/sidebar_section.rb:26:in `build_sidebar_content'
activeadmin (3.2.0) lib/active_admin/views/components/sidebar_section.rb:14:in `build'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:50:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:27:in `build_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:40:in `insert_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:15:in `sidebar_section'
activeadmin (3.2.0) lib/active_admin/views/components/sidebar.rb:10:in `map'
activeadmin (3.2.0) lib/active_admin/views/components/sidebar.rb:10:in `build'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:50:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:27:in `build_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:40:in `insert_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:15:in `sidebar'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:88:in `block in build_page_content'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:32:in `block in build_tag'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:50:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:27:in `build_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:40:in `insert_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:15:in `div'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:86:in `build_page_content'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:63:in `block (2 levels) in build_page'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:32:in `block in build_tag'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:50:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:27:in `build_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:40:in `insert_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:15:in `div'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:59:in `block in build_page'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:50:in `with_current_arbre_element'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:58:in `build_page'
activeadmin (3.2.0) lib/active_admin/views/pages/base.rb:10:in `build'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.7.0) lib/arbre/context.rb:94:in `with_current_arbre_element'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:27:in `build_tag'
arbre (1.7.0) lib/arbre/element/builder_methods.rb:40:in `insert_tag'
activeadmin (3.2.0) app/views/active_admin/resource/index.html.arb:3
arbre (1.7.0) lib/arbre/context.rb:47:in `instance_eval'
arbre (1.7.0) lib/arbre/context.rb:47:in `initialize'
activeadmin (3.2.0) app/views/active_admin/resource/index.html.arb:1:in `new'
activeadmin (3.2.0) app/views/active_admin/resource/index.html.arb:1
actionview (7.1.2) lib/action_view/base.rb:264:in `public_send'
actionview (7.1.2) lib/action_view/base.rb:264:in `_run'
actionview (7.1.2) lib/action_view/template.rb:261:in `block in render'
activesupport (7.1.2) lib/active_support/notifications.rb:208:in `instrument'
actionview (7.1.2) lib/action_view/template.rb:549:in `instrument_render_template'
actionview (7.1.2) lib/action_view/template.rb:249:in `render'
actionview (7.1.2) lib/action_view/renderer/template_renderer.rb:66:in `block (2 levels) in render_template'
activesupport (7.1.2) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.1.2) lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport (7.1.2) lib/active_support/notifications.rb:206:in `instrument'
actionview (7.1.2) lib/action_view/renderer/template_renderer.rb:60:in `block in render_template'
actionview (7.1.2) lib/action_view/renderer/template_renderer.rb:80:in `render_with_layout'
actionview (7.1.2) lib/action_view/renderer/template_renderer.rb:59:in `render_template'
actionview (7.1.2) lib/action_view/renderer/template_renderer.rb:11:in `render'
actionview (7.1.2) lib/action_view/renderer/renderer.rb:63:in `render_template_to_object'
actionview (7.1.2) lib/action_view/renderer/renderer.rb:31:in `render_to_object'
actionview (7.1.2) lib/action_view/rendering.rb:135:in `block in _render_template'
actionview (7.1.2) lib/action_view/base.rb:291:in `in_rendering_context'
actionview (7.1.2) lib/action_view/rendering.rb:134:in `_render_template'
actionpack (7.1.2) lib/action_controller/metal/streaming.rb:256:in `_render_template'
actionview (7.1.2) lib/action_view/rendering.rb:121:in `render_to_body'
actionpack (7.1.2) lib/action_controller/metal/rendering.rb:158:in `render_to_body'
actionpack (7.1.2) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (7.1.2) lib/abstract_controller/rendering.rb:27:in `render'
actionpack (7.1.2) lib/action_controller/metal/rendering.rb:139:in `render'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:29:in `block (2 levels) in render'
/Users/ishmeetsingh/.rbenv/versions/3.3.0/lib/ruby/3.3.0/benchmark.rb:313:in `realtime'
activesupport (7.1.2) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:29:in `block in render'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:98:in `cleanup_view_runtime'
activerecord (7.1.2) lib/active_record/railties/controller_runtime.rb:39:in `cleanup_view_runtime'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:28:in `render'
responders (3.1.1) lib/action_controller/responder.rb:245:in `default_render'
responders (3.1.1) lib/action_controller/responder.rb:175:in `to_html'
responders (3.1.1) lib/responders/flash_responder.rb:105:in `to_html'
responders (3.1.1) lib/action_controller/responder.rb:168:in `respond'
responders (3.1.1) lib/action_controller/responder.rb:161:in `call'
responders (3.1.1) lib/action_controller/respond_with.rb:216:in `respond_with'
inherited_resources (1.14.0) lib/inherited_resources/actions.rb:7:in `index'
activeadmin (3.2.0) lib/active_admin/resource_controller/streaming.rb:13:in `index'
actionpack (7.1.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.1.2) lib/abstract_controller/base.rb:224:in `process_action'
actionpack (7.1.2) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.1.2) lib/abstract_controller/callbacks.rb:259:in `block in process_action'
activesupport (7.1.2) lib/active_support/callbacks.rb:121:in `block in run_callbacks'
actiontext (7.1.2) lib/action_text/rendering.rb:23:in `with_renderer'
actiontext (7.1.2) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
activesupport (7.1.2) lib/active_support/callbacks.rb:130:in `instance_exec'
activesupport (7.1.2) lib/active_support/callbacks.rb:130:in `block in run_callbacks'
activesupport (7.1.2) lib/active_support/callbacks.rb:141:in `run_callbacks'
actionpack (7.1.2) lib/abstract_controller/callbacks.rb:258:in `process_action'
actionpack (7.1.2) lib/action_controller/metal/rescue.rb:25:in `process_action'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'
activesupport (7.1.2) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.1.2) lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport (7.1.2) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.1.2) lib/action_controller/metal/instrumentation.rb:73:in `process_action'
actionpack (7.1.2) lib/action_controller/metal/params_wrapper.rb:261:in `process_action'
activerecord (7.1.2) lib/active_record/railties/controller_runtime.rb:32:in `process_action'
actionpack (7.1.2) lib/abstract_controller/base.rb:160:in `process'
actionview (7.1.2) lib/action_view/rendering.rb:40:in `process'
actionpack (7.1.2) lib/action_controller/metal.rb:227:in `dispatch'
actionpack (7.1.2) lib/action_controller/metal.rb:309:in `dispatch'
actionpack (7.1.2) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.1.2) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.1.2) lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack (7.1.2) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack (7.1.2) lib/action_dispatch/journey/router.rb:124:in `each'
actionpack (7.1.2) lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack (7.1.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.1.2) lib/action_dispatch/routing/route_set.rb:882:in `call'
bullet (7.1.4) lib/bullet/rack.rb:17:in `call'
rack-attack (6.7.0) lib/rack/attack.rb:103:in `call'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/cookies.rb:689:in `call'
rack (3.0.8) lib/rack/method_override.rb:28:in `call'
i18n (1.14.1) lib/i18n/middleware.rb:11:in `call'
rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (3.0.8) lib/rack/etag.rb:29:in `call'
rack (3.0.8) lib/rack/conditional_get.rb:31:in `call'
rack (3.0.8) lib/rack/head.rb:15:in `call'
activerecord (7.1.2) lib/active_record/migration.rb:654:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (7.1.2) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (7.1.2) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/actionable_exceptions.rb:16:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (7.1.2) lib/rails/rack/logger.rb:37:in `call_app'
railties (7.1.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (7.1.2) lib/active_support/tagged_logging.rb:135:in `block in tagged'
activesupport (7.1.2) lib/active_support/tagged_logging.rb:39:in `tagged'
activesupport (7.1.2) lib/active_support/tagged_logging.rb:135:in `tagged'
activesupport (7.1.2) lib/active_support/broadcast_logger.rb:240:in `method_missing'
railties (7.1.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/request_id.rb:28:in `call'
rack (3.0.8) lib/rack/runtime.rb:24:in `call'
activesupport (7.1.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/server_timing.rb:59:in `block in call'
actionpack (7.1.2) lib/action_dispatch/middleware/server_timing.rb:24:in `collect_events'
actionpack (7.1.2) lib/action_dispatch/middleware/server_timing.rb:58:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/static.rb:25:in `call'
rack (3.0.8) lib/rack/sendfile.rb:114:in `call'
actionpack (7.1.2) lib/action_dispatch/middleware/host_authorization.rb:141:in `call'
railties (7.1.2) lib/rails/engine.rb:529:in `call'
puma (6.4.0) lib/puma/configuration.rb:272:in `call'
puma (6.4.0) lib/puma/request.rb:100:in `block in handle_request'
puma (6.4.0) lib/puma/thread_pool.rb:378:in `with_force_shutdown'
puma (6.4.0) lib/puma/request.rb:99:in `handle_request'
puma (6.4.0) lib/puma/server.rb:443:in `process_client'
puma (6.4.0) lib/puma/server.rb:241:in `block in run'
puma (6.4.0) lib/puma/thread_pool.rb:155:in `block in spawn_thread'
Rails Version: 7.1.2
Ruby Version: 3.3.0
ActiveAdmin Version: 3.2.0
Ransack Version: 4.1.1
You would encounter these issues with Ransack version 4 as they save made it mandatory to explict allowlisting of attributes and associations.
https://github.com/activerecord-hackery/ransack/releases/tag/v4.0.0
There are two ways to fix this
def self.ransackable_associations(_auth_object = nil) = %w[events]
def self.ransackable_attributes(_auth_object = nil) = %w[state]
config.filters = false