我已经在我的rails应用程序中安装了活动的admin gem。我很好地整合了我的模型。登录管理员面板并想查看我的记录后,显示此错误。更新和提交按钮时会出现此错误。但在内部文件更新和编辑,没有副作用。
我已将记录与will paginate集成。
我已将此文件添加到/config/initializers/kaminari.rb
,但无法解决...
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
end
完整的错误是:
undefined method `total_count' for #<ActiveRecord::Relation []>
Did you mean? total_entries
提取的来源(第124行):
122 arel.public_send(method, *args, &block)
123 else
124 super
125 end
126 end
127 end
Application Trace | Framework Trace | Full Trace
activerecord (5.0.2) lib/active_record/relation/delegation.rb:124:in `method_missing'
activerecord (5.0.2) lib/active_record/relation/delegation.rb:94:in `method_missing'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb:23:in `title'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb:16:in `build'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:14:in `active_admin_comments_for'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/orm/active_record/comments/show_page_helper.rb:18:in `active_admin_comments'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/orm/active_record/comments/show_page_helper.rb:12:in `default_main_content'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/show.rb:23:in `main_content'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:91:in `block (2 levels) in build_main_content_wrapper'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:14:in `div'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:90:in `block in build_main_content_wrapper'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:14:in `div'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:89:in `build_main_content_wrapper'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:75:in `block in build_page_content'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:14:in `div'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:74:in `build_page_content'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:52:in `block (2 levels) in build_page'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:14:in `div'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:48:in `block in build_page'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:47:in `build_page'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/lib/active_admin/views/pages/base.rb:10:in `build'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/app/views/active_admin/resource/show.html.arb:2:in `block in __home_madhav__rbenv_versions_______lib_ruby_gems_______bundler_gems_activeadmin_____ea_f_fd__app_views_active_admin_resource_show_html_arb___2047537122749437189_69832972317760'
arbre (1.1.1) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.1.1) lib/arbre/context.rb:45:in `initialize'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/app/views/active_admin/resource/show.html.arb:1:in `new'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/activeadmin-6038ea6f8fd0/app/views/active_admin/resource/show.html.arb:1:in `__home_madhav__rbenv_versions_______lib_ruby_gems_______bundler_gems_activeadmin_____ea_f_fd__app_views_active_admin_resource_show_html_arb___2047537122749437189_69832972317760'
actionview (5.0.2) lib/action_view/template.rb:159:in `block in render'
activesupport (5.0.2) lib/active_support/notifications.rb:166:in `instrument'
actionview (5.0.2) lib/action_view/template.rb:354:in `instrument'
actionview (5.0.2) lib/action_view/template.rb:157:in `render'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
actionview (5.0.2) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `instrument'
actionview (5.0.2) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.0.2) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.0.2) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.0.2) lib/action_view/rendering.rb:104:in `_render_template'
actionpack (5.0.2) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.0.2) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.0.2) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (5.0.2) lib/abstract_controller/rendering.rb:26:in `render'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/madhav/.rbenv/versions/2.3.1/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
responders (2.4.0) lib/action_controller/responder.rb:238:in `default_render'
responders (2.4.0) lib/action_controller/responder.rb:170:in `to_html'
responders (2.4.0) lib/responders/flash_responder.rb:107:in `to_html'
responders (2.4.0) lib/action_controller/responder.rb:163:in `respond'
responders (2.4.0) lib/action_controller/responder.rb:156:in `call'
responders (2.4.0) lib/action_controller/respond_with.rb:211:in `respond_with'
inherited_resources (1.7.2) lib/inherited_resources/actions.rb:13:in `show'
actionpack (5.0.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.2) lib/abstract_controller/base.rb:188:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.2) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.2) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.2) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.2) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.2) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.2) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.2) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.2) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.2) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.2) lib/rails/engine.rb:522:in `call'
puma (3.8.2) lib/puma/configuration.rb:224:in `call'
puma (3.8.2) lib/puma/server.rb:600:in `handle_request'
puma (3.8.2) lib/puma/server.rb:435:in `process_client'
puma (3.8.2) lib/puma/server.rb:299:in `block in run'
puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
错误的屏幕截图是:
答案 0 :(得分:0)
我已停用有效的管理员评论。以前,默认情况下会在文件中启用注释
/config/initializers/active_admin.rb
# You can completely disable comments:
# config.comments = false
我通过更改代码禁用了有效的管理员评论:
# You can completely disable comments:
config.comments = false
最后摆脱那个错误。 谢谢大家。